From ba2b9c8a1bb1876b6eb4c9783fde798b19de4418 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 24 May 2023 08:32:08 -0400 Subject: init --- node/go.mod | 5 ----- node/go.sum | 2 -- node/node.go | 15 --------------- node/stack.go | 32 -------------------------------- 4 files changed, 54 deletions(-) delete mode 100644 node/go.mod delete mode 100644 node/go.sum delete mode 100644 node/node.go delete mode 100644 node/stack.go (limited to 'node') diff --git a/node/go.mod b/node/go.mod deleted file mode 100644 index 725da6d..0000000 --- a/node/go.mod +++ /dev/null @@ -1,5 +0,0 @@ -module s00.xyz/evm - -go 1.20 - -require github.com/holiman/uint256 v1.2.2 // indirect diff --git a/node/go.sum b/node/go.sum deleted file mode 100644 index e0f03a0..0000000 --- a/node/go.sum +++ /dev/null @@ -1,2 +0,0 @@ -github.com/holiman/uint256 v1.2.2 h1:TXKcSGc2WaxPD2+bmzAsVthL4+pEN0YwXcL5qED83vk= -github.com/holiman/uint256 v1.2.2/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= diff --git a/node/node.go b/node/node.go deleted file mode 100644 index 18640e9..0000000 --- a/node/node.go +++ /dev/null @@ -1,15 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/holiman/uint256" -) - -func main() { - s := NewStack() - x, _ := uint256.FromHex("0xfeedface") - s.Push(x) - y := s.Pop() - fmt.Println(y.String()) -} diff --git a/node/stack.go b/node/stack.go deleted file mode 100644 index a5460a7..0000000 --- a/node/stack.go +++ /dev/null @@ -1,32 +0,0 @@ -package main - -import ( - "log" - - "github.com/holiman/uint256" -) - -const STACK_CAP = (1 << 10) - -type Stack []uint256.Int - -func NewStack() *Stack { - return &Stack{} -} - -func (s *Stack) Push(x *uint256.Int) { - *s = append(*s, *x) - if len(*s) > STACK_CAP { - log.Fatal("stack overflow") - } -} - -func (s *Stack) Pop() *uint256.Int { - if len(*s) <= 0 { - log.Fatal("stack underflow") - } - - r := (*s)[len(*s)-1] - *s = (*s)[:len(*s)-1] - return &r -} -- cgit v1.2.3