Skip to content

Commit

Permalink
Agharta/eip1014 create2 (#5)
Browse files Browse the repository at this point in the history
* Created branch & added new opcode into opcode.go file

* Added create2 function

* Implemented create function for Create2 contracts

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Implemented create function for Create2 contracts

* Finished Create2 opcode & cleaned up comments

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Atlantis config (#50)

* Added Atlantis fork in builtin mainnet and morden config

* Fixed difficulty test at 10_000_000 block (Atlantis)

* Added tests for Atlantis difficulty transition

* cmd/geth rename client (#52)

* Added error handling for precompiles and removed skipped tests (#54)

* Makefile and README updates (#49)

* wip makefile updates

* Fixed makefile and updated README

* Fixed readme changes

* Added go module documentation and fixed wiki links to EP

* Added go modules on for makefile commands and documentation

* makefile: fix version string (#57)

* Dockerfile configuration (#56)

* Added Dockerfile setup

* Added Dockerfile setup

* Fixed build command

* Removed private repo authentication in Dockerfile

* Enforced go modules on for every part of the test command (#60)

* docs: update readme (#59)

* docs: update readme

* Update README.md

* Update README.md

* ci: prepare assets for release (#64)

* ci: prepare assets for release

* ci: fix indentation

* ci: fix indentation

* ci: fix indentation

* ci: fix indentation

* ci: release in build step

* ci: calculate sha256sums

* ci: store artifacts

* ci: do a reverse copy

* ci: fix bash syntax

* ci: indicate os in release

* ci: pushd and pop'd ;)

* Receipt fixes and state trie clearing detail (#62)

* receipt and state trie clearing changes

* Fixed receipt storage and added backward compatible decoding

* Implemented create function for Create2 contracts

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Implemented create function for Create2 contracts

* Finished Create2 opcode & cleaned up comments

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Atlantis config (#50)

* Added Atlantis fork in builtin mainnet and morden config

* Fixed difficulty test at 10_000_000 block (Atlantis)

* Added tests for Atlantis difficulty transition

* cmd/geth rename client (#52)

* Added error handling for precompiles and removed skipped tests (#54)

* Makefile and README updates (#49)

* wip makefile updates

* Fixed makefile and updated README

* Fixed readme changes

* Added go module documentation and fixed wiki links to EP

* Added go modules on for makefile commands and documentation

* makefile: fix version string (#57)

* Dockerfile configuration (#56)

* Added Dockerfile setup

* Added Dockerfile setup

* Fixed build command

* Removed private repo authentication in Dockerfile

* Enforced go modules on for every part of the test command (#60)

* docs: update readme (#59)

* docs: update readme

* Update README.md

* Update README.md

* ci: prepare assets for release (#64)

* ci: prepare assets for release

* ci: fix indentation

* ci: fix indentation

* ci: fix indentation

* ci: fix indentation

* ci: release in build step

* ci: calculate sha256sums

* ci: store artifacts

* ci: do a reverse copy

* ci: fix bash syntax

* ci: indicate os in release

* ci: pushd and pop'd ;)

* Receipt fixes and state trie clearing detail (#62)

* receipt and state trie clearing changes

* Fixed receipt storage and added backward compatible decoding

* Implemented create function for Create2 contracts

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Implemented create function for Create2 contracts

* Finished Create2 opcode & cleaned up comments

* Created branch & added new opcode into opcode.go file

* Added create2 function

* Added error handling for precompiles and removed skipped tests (#54)

* Created branch & added new opcode into opcode.go file

* Implemented create function for Create2 contracts

* Added create2 function

* Implemented create function for Create2 contracts

* Rebased with development 2nd

* Cleaned up code/comments & removed print statements.

* Cleaned up comments & reverted go.mod & go.sum to original

* Removed Constantinople tests & some tests involving non-implemented opcodes (EIP 145/1052) to pass CI.

* Fixed removal of stBugs, stShift & stExtCodeHash tests

* Fixed instructions_test salt parameter passed to CreateAddress2.

* Changed local vars to camel case

* Fixed error refactor.

* Cleaned up comments. Skipped tests involving EIP684 (Collision).

* Fixed error checking for evm.Run().
  • Loading branch information
dziabko committed Sep 24, 2019
1 parent a7e1062 commit c7f1161
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 8 deletions.
70 changes: 70 additions & 0 deletions core/vm/instructions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,76 @@ func TestCreate2Addresses(t *testing.T) {
}


func TestCreate2Addresses(t *testing.T) {
type testcase struct {
origin string
salt string
code string
expected string
}

for i, tt := range []testcase{
{
origin: "0x0000000000000000000000000000000000000000",
salt: "0x0000000000000000000000000000000000000000",
code: "0x00",
expected: "0x4d1a2e2bb4f88f0250f26ffff098b0b30b26bf38",
},
{
origin: "0xdeadbeef00000000000000000000000000000000",
salt: "0x0000000000000000000000000000000000000000",
code: "0x00",
expected: "0xB928f69Bb1D91Cd65274e3c79d8986362984fDA3",
},
{
origin: "0xdeadbeef00000000000000000000000000000000",
salt: "0xfeed000000000000000000000000000000000000",
code: "0x00",
expected: "0xD04116cDd17beBE565EB2422F2497E06cC1C9833",
},
{
origin: "0x0000000000000000000000000000000000000000",
salt: "0x0000000000000000000000000000000000000000",
code: "0xdeadbeef",
expected: "0x70f2b2914A2a4b783FaEFb75f459A580616Fcb5e",
},
{
origin: "0x00000000000000000000000000000000deadbeef",
salt: "0xcafebabe",
code: "0xdeadbeef",
expected: "0x60f3f640a8508fC6a86d45DF051962668E1e8AC7",
},
{
origin: "0x00000000000000000000000000000000deadbeef",
salt: "0xcafebabe",
code: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
expected: "0x1d8bfDC5D46DC4f61D6b6115972536eBE6A8854C",
},
{
origin: "0x0000000000000000000000000000000000000000",
salt: "0x0000000000000000000000000000000000000000",
code: "0x",
expected: "0xE33C0C7F7df4809055C3ebA6c09CFe4BaF1BD9e0",
},
} {

origin := common.BytesToAddress(common.FromHex(tt.origin))
salt := common.BytesToHash(common.FromHex(tt.salt))
code := common.FromHex(tt.code)
codeHash := crypto.Keccak256(code)

address := crypto.CreateAddress2(origin, salt.Bytes(), codeHash)

expected := common.BytesToAddress(common.FromHex(tt.expected))

if !bytes.Equal(expected.Bytes(), address.Bytes()) {
t.Errorf("test %d: expected %s, got %s", i, expected.Str(), address.Str())
}

}
}


type TwoOperandTestcase struct {
X string
Y string
Expand Down
8 changes: 0 additions & 8 deletions tests/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,10 @@ var Forks = map[string]RuleSet{
DiehardBlock: big.NewInt(0),
AtlantisBlock: big.NewInt(0),
},
"Constantinople": {
HomesteadBlock: big.NewInt(0),
HomesteadGasRepriceBlock: big.NewInt(0),
DiehardBlock: big.NewInt(0),
AtlantisBlock: big.NewInt(0),
AghartaBlock: big.NewInt(0),
},
"ConstantinopleFix": {
HomesteadBlock: big.NewInt(0),
HomesteadGasRepriceBlock: big.NewInt(0),
DiehardBlock: big.NewInt(0),
ExplosionBlock: big.NewInt(0),
AtlantisBlock: big.NewInt(0),
AghartaBlock: big.NewInt(0),
},
Expand Down

0 comments on commit c7f1161

Please sign in to comment.