Giter Site home page Giter Site logo

eth-classic / go-ethereum Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 6.0 25.59 MB

Go implementation of the Ethereum Classic protocol. Moved:

Home Page: https://github.com/etclabscore/go-ethereum

License: GNU Lesser General Public License v3.0

Makefile 0.10% Go 92.81% Shell 0.77% M4 0.13% C 5.08% C++ 1.03% Java 0.02% Assembly 0.05% Dockerfile 0.01%

go-ethereum's People

Contributors

austinabell avatar noot avatar soc1c avatar steviezhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

go-ethereum's Issues

Add ethereum submodule tests to CircleCI

Not sure if this is necessary since it will slow down to CircleCI tests and it is assumed reviewers will test with the Ethereum submodule downloaded, but those tests are not included in the CircleCI test.

Continuous Integration

Setup Circle CI or Gitlab CI, the problem is that this is not free for private repositories.

But we need some automated building and testing.

InvalidStateRoot on Morden

Parity Ethereum 2.5.5

2019-07-28 20:31:05  Submitted block imported OK. #4729795: 5f906f4b36d9d667004c17a200c7e81c11c7b8fe6afecec079be85d05c38f662
2019-07-28 20:31:05  Imported #4729795 0x5f90…f662 (0 txs, 0.00 Mgas, 11 ms, 0.52 KiB)
2019-07-28 20:31:11     8/25 peers   933 KiB chain 9 MiB db 0 bytes queue 13 KiB sync  RPC:  0 conn,    4 req/s,   64 µs
2019-07-28 20:31:43  Imported #4729796 0xc6c4…1f43 (0 txs, 0.00 Mgas, 0 ms, 0.50 KiB)
2019-07-28 20:31:46     8/25 peers   933 KiB chain 9 MiB db 0 bytes queue 13 KiB sync  RPC:  0 conn,    4 req/s,   65 µs
2019-07-28 20:31:57  Stage 5 block verification failed for #4729797 (0x118c…e550)
Error: Error(Block(InvalidStateRoot(Mismatch { expected: 0x4bcd0fc60a213f583b2c4414f5a378ce5db555ad767d1a09a1e83359087b67ce, found: 0xfa13470eb4a903951cddc885b7f575b87f94bea4a44b80724663a47a5c4a9da7 })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
2019-07-28 20:31:57  
Bad block detected: Error(Block(InvalidStateRoot(Mismatch { expected: 0x4bcd0fc60a213f583b2c4414f5a378ce5db555ad767d1a09a1e83359087b67ce, found: 0xfa13470eb4a903951cddc885b7f575b87f94bea4a44b80724663a47a5c4a9da7 })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
RLP: f90634f901fea0c6c4a38b7238472999a62783e191399a9f2ff9089e258a3febc424287aa91f43a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794c931b469a707e55d738fb46e16db65abcda037bea04bcd0fc60a213f583b2c4414f5a378ce5db555ad767d1a09a1e83359087b67cea0c569c93b30be792f132072a16637e725fe2cf95b88486bedbfeb0b07c88fe226a0d96459bc12f49d4023166247226b0e84a53ba7e7418dc4e955809ca934295f1fb9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000841fa5b57683482bc583691acc8304ff6f845d3e4c7f80a0bf5457ae81d15b5e8d10370c5efdd24a99a90918298082f270d22d5f7443171b8878ae1c0010aadbdcf9042ff9042c831006a58504a817c800830f42408080b903d56060604052341561000f57600080fd5b6040516020806103b58339810160405280805160008054600160a060020a03338116600160a060020a0319928316179092556001805492909316911617905550506103568061005f6000396000f3006060604052600436106100535763ffffffff60e060020a60003504166310c42eaf81146100555780634d63a5421461006c5780634fe870ab146100995780635bee6f92146100c85780638da5cb5b146100e7575b005b610053600160a060020a03600435166024356100fa565b610053600160a060020a03600435166024356fffffffffffffffffffffffffffffffff19604435166101c2565b34156100a457600080fd5b6100ac6102c2565b604051600160a060020a03909116815260200160405180910390f35b34156100d357600080fd5b610053600160a060020a03600435166102d1565b34156100f257600080fd5b6100ac61031b565b60005433600160a060020a039081169116148061017f5750600154600160a060020a031663fe9fbb803360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561016257600080fd5b5af1151561016f57600080fd5b5050506040518051151560011490505b151561018a57600080fd5b600160a060020a03821634820180156108fc0290604051600060405180830381858888f1935050505015156101be57600080fd5b5050565b60005433600160a060020a03908116911614806102475750600154600160a060020a031663fe9fbb803360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561022a57600080fd5b5af1151561023757600080fd5b5050506040518051151560011490505b151561025257600080fd5b82600160a060020a031663359d1f118334018360405160e060020a63ffffffff85160281526fffffffffffffffffffffffffffffffff1990911660048201526024016000604051808303818588803b15156102ac57600080fd5b5af115156102b957600080fd5b50505050505050565b600154600160a060020a031681565b60005433600160a060020a039081169116146102ec57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a0316815600a165627a7a7230582046ee003a7d8c03a02f6ba3dfdb80862c30abaf5fcbb8d5cbfccde55270e6e2a3002900000000000000000000000072dab16d86da2e2c05d0bff39477f271b059dd0e819fa045ced644cf9c6645de1933c8ebfddd734c6605e050e1419e5d39d924424e31c1a04af8aaf6e2a2b16598b3980bcf287fb3009dc52bdf793a01a225148c18a61150c0
Header: Header { parent_hash: 0xc6c4a38b7238472999a62783e191399a9f2ff9089e258a3febc424287aa91f43, timestamp: 1564363903, number: 4729797, author: 0xc931b469a707e55d738fb46e16db65abcda037be, transactions_root: 0xc569c93b30be792f132072a16637e725fe2cf95b88486bedbfeb0b07c88fe226, uncles_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, extra_data: [], state_root: 0x4bcd0fc60a213f583b2c4414f5a378ce5db555ad767d1a09a1e83359087b67ce, receipts_root: 0xd96459bc12f49d4023166247226b0e84a53ba7e7418dc4e955809ca934295f1f, log_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, gas_used: 327535, gas_limit: 6888140, difficulty: 530953590, seal: [[160, 191, 84, 87, 174, 129, 209, 91, 94, 141, 16, 55, 12, 94, 253, 210, 74, 153, 169, 9, 24, 41, 128, 130, 242, 112, 210, 45, 95, 116, 67, 23, 27], [136, 120, 174, 28, 0, 16, 170, 219, 220]], hash: Some(0x118c7b9aa7dad9da4887b6043964b3fdb8dd5e00647952f229b50d6ca8ffe550) }
Uncles: 
Transactions:[Tx 0] UnverifiedTransaction { unsigned: Transaction { nonce: 1050277, gas_price: 20000000000, gas: 1000000, action: Create, value: 0, data: [96, 96, 96, 64, 82, 52, 21, 97, 0, 15, 87, 96, 0, 128, 253, 91, 96, 64, 81, 96, 32, 128, 97, 3, 181, 131, 57, 129, 1, 96, 64, 82, 128, 128, 81, 96, 0, 128, 84, 96, 1, 96, 160, 96, 2, 10, 3, 51, 129, 22, 96, 1, 96, 160, 96, 2, 10, 3, 25, 146, 131, 22, 23, 144, 146, 85, 96, 1, 128, 84, 146, 144, 147, 22, 145, 22, 23, 144, 85, 80, 80, 97, 3, 86, 128, 97, 0, 95, 96, 0, 57, 96, 0, 243, 0, 96, 96, 96, 64, 82, 96, 4, 54, 16, 97, 0, 83, 87, 99, 255, 255, 255, 255, 96, 224, 96, 2, 10, 96, 0, 53, 4, 22, 99, 16, 196, 46, 175, 129, 20, 97, 0, 85, 87, 128, 99, 77, 99, 165, 66, 20, 97, 0, 108, 87, 128, 99, 79, 232, 112, 171, 20, 97, 0, 153, 87, 128, 99, 91, 238, 111, 146, 20, 97, 0, 200, 87, 128, 99, 141, 165, 203, 91, 20, 97, 0, 231, 87, 91, 0, 91, 97, 0, 83, 96, 1, 96, 160, 96, 2, 10, 3, 96, 4, 53, 22, 96, 36, 53, 97, 0, 250, 86, 91, 97, 0, 83, 96, 1, 96, 160, 96, 2, 10, 3, 96, 4, 53, 22, 96, 36, 53, 111, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25, 96, 68, 53, 22, 97, 1, 194, 86, 91, 52, 21, 97, 0, 164, 87, 96, 0, 128, 253, 91, 97, 0, 172, 97, 2, 194, 86, 91, 96, 64, 81, 96, 1, 96, 160, 96, 2, 10, 3, 144, 145, 22, 129, 82, 96, 32, 1, 96, 64, 81, 128, 145, 3, 144, 243, 91, 52, 21, 97, 0, 211, 87, 96, 0, 128, 253, 91, 97, 0, 83, 96, 1, 96, 160, 96, 2, 10, 3, 96, 4, 53, 22, 97, 2, 209, 86, 91, 52, 21, 97, 0, 242, 87, 96, 0, 128, 253, 91, 97, 0, 172, 97, 3, 27, 86, 91, 96, 0, 84, 51, 96, 1, 96, 160, 96, 2, 10, 3, 144, 129, 22, 145, 22, 20, 128, 97, 1, 127, 87, 80, 96, 1, 84, 96, 1, 96, 160, 96, 2, 10, 3, 22, 99, 254, 159, 187, 128, 51, 96, 64, 81, 96, 224, 96, 2, 10, 99, 255, 255, 255, 255, 132, 22, 2, 129, 82, 96, 1, 96, 160, 96, 2, 10, 3, 144, 145, 22, 96, 4, 130, 1, 82, 96, 36, 1, 96, 32, 96, 64, 81, 128, 131, 3, 129, 96, 0, 135, 128, 59, 21, 21, 97, 1, 98, 87, 96, 0, 128, 253, 91, 90, 241, 21, 21, 97, 1, 111, 87, 96, 0, 128, 253, 91, 80, 80, 80, 96, 64, 81, 128, 81, 21, 21, 96, 1, 20, 144, 80, 91, 21, 21, 97, 1, 138, 87, 96, 0, 128, 253, 91, 96, 1, 96, 160, 96, 2, 10, 3, 130, 22, 52, 130, 1, 128, 21, 97, 8, 252, 2, 144, 96, 64, 81, 96, 0, 96, 64, 81, 128, 131, 3, 129, 133, 136, 136, 241, 147, 80, 80, 80, 80, 21, 21, 97, 1, 190, 87, 96, 0, 128, 253, 91, 80, 80, 86, 91, 96, 0, 84, 51, 96, 1, 96, 160, 96, 2, 10, 3, 144, 129, 22, 145, 22, 20, 128, 97, 2, 71, 87, 80, 96, 1, 84, 96, 1, 96, 160, 96, 2, 10, 3, 22, 99, 254, 159, 187, 128, 51, 96, 64, 81, 96, 224, 96, 2, 10, 99, 255, 255, 255, 255, 132, 22, 2, 129, 82, 96, 1, 96, 160, 96, 2, 10, 3, 144, 145, 22, 96, 4, 130, 1, 82, 96, 36, 1, 96, 32, 96, 64, 81, 128, 131, 3, 129, 96, 0, 135, 128, 59, 21, 21, 97, 2, 42, 87, 96, 0, 128, 253, 91, 90, 241, 21, 21, 97, 2, 55, 87, 96, 0, 128, 253, 91, 80, 80, 80, 96, 64, 81, 128, 81, 21, 21, 96, 1, 20, 144, 80, 91, 21, 21, 97, 2, 82, 87, 96, 0, 128, 253, 91, 130, 96, 1, 96, 160, 96, 2, 10, 3, 22, 99, 53, 157, 31, 17, 131, 52, 1, 131, 96, 64, 81, 96, 224, 96, 2, 10, 99, 255, 255, 255, 255, 133, 22, 2, 129, 82, 111, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25, 144, 145, 22, 96, 4, 130, 1, 82, 96, 36, 1, 96, 0, 96, 64, 81, 128, 131, 3, 129, 133, 136, 128, 59, 21, 21, 97, 2, 172, 87, 96, 0, 128, 253, 91, 90, 241, 21, 21, 97, 2, 185, 87, 96, 0, 128, 253, 91, 80, 80, 80, 80, 80, 80, 80, 86, 91, 96, 1, 84, 96, 1, 96, 160, 96, 2, 10, 3, 22, 129, 86, 91, 96, 0, 84, 51, 96, 1, 96, 160, 96, 2, 10, 3, 144, 129, 22, 145, 22, 20, 97, 2, 236, 87, 96, 0, 128, 253, 91, 96, 1, 128, 84, 115, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 25, 22, 96, 1, 96, 160, 96, 2, 10, 3, 146, 144, 146, 22, 145, 144, 145, 23, 144, 85, 86, 91, 96, 0, 84, 96, 1, 96, 160, 96, 2, 10, 3, 22, 129, 86, 0, 161, 101, 98, 122, 122, 114, 48, 88, 32, 70, 238, 0, 58, 125, 140, 3, 160, 47, 107, 163, 223, 219, 128, 134, 44, 48, 171, 175, 95, 203, 184, 213, 203, 252, 205, 229, 82, 112, 230, 226, 163, 0, 41, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 114, 218, 177, 109, 134, 218, 46, 44, 5, 208, 191, 243, 148, 119, 242, 113, 176, 89, 221, 14] }, v: 159, r: 31575035876448297915920780314640879437468414719062631714274961722679164285377, s: 33910508820120092485694672021070842149430121309355948487937833645639136055632, hash: 0x9c86be2f3ed4a5102d3f8a9b766535500ff910bb421f701eefaa1eb4594eaa46 }

Block was imported from Geth Classic 6.0.6, and contains a transaction, probably @tzdybal was testing something.

Failing tests due to lack of implementation

So currently with state trie clearing implemented, all tests are passing except some that are intentionally skipped due to the functionality not implemented yet, or not planned to be implemented.

I will group each missing functionality with it's skipped tests:

Atlantis planned changes

EIP 214 - STATICCALL

  unsupportedDirs := map[string]bool{
     ...
    "stStaticCall":  true,
     ...
  }
skipTests["staticcall_createfails.json"] = "STATICCALL Not Implemented"

EIP 140 - REVERT

  unsupportedDirs := map[string]bool{
     ...
    "stRevertTest":  true,
     ...
  }
	skipTests["FailedCreateRevertsDeletion.json"] = "REVERT Not Implemented"
	skipTests["CreateOOGafterInitCodeRevert.json"] = "REVERT Not Implemented"
	skipTests["CreateOOGafterInitCodeRevert2.json"] = "REVERT Not Implemented"

EIP 211 - RETURNDATASIZE/ RETURNDATACOPY

  unsupportedDirs := map[string]bool{
     ...
    "stReturnDataTest":  true,
     ...
  }
	skipTests["CreateOOGafterInitCodeReturndataSize.json"] = "REVERT Not Implemented"
	skipTests["CreateOOGafterInitCodeReturndata2.json"] = "REVERT Not Implemented"

EIP 196/197/198 Precompiles (Maybe not all are planned to be completed)

  unsupportedDirs := map[string]bool{
     ...
    "stPreCompiledContracts":  true,
    "stPreCompiledContracts2": true,

    // And I am pretty sure these two because they reference the precompiles
    "stZeroKnowledge":         true,
    "stZeroKnowledge2":        true,
     ...
  }

EIP 170 Code size limit

  unsupportedDirs := map[string]bool{
     ...
    "stCodeSizeLimit":  true,
     ...
  }

All of the above skips should be removed when implemented in Atlantis

Non specific Atlantis skips:

EIP 684/689 ? Transaction collision updates

	skipTests["TransactionCollisionToEmptyButCode.json"] = "Not Implemented"
	skipTests["TransactionCollisionToEmpty.json"] = "Not Implemented"
	skipTests["TransactionCollisionToEmptyButNonce.json"] = "Not Implemented"
	skipTests["CreateCollisionToEmpty.json"] = "Not Implemented"
	skipTests["CreateHashCollision.json"] = "Not Implemented"
	skipTests["createJS_ExampleContract.json"] = "Not Implemented"

EIP 1014 Create2 (Agharta)

  unsupportedDirs := map[string]bool{
     ...
    "stCreate2":  true,
     ...
  }

Unknown test functionality skip:

		skipTests["CREATE_ContractRETURNBigOffset.json"] = "random unimplemented"

This one is not referenced anywhere and not implemented with an EIP. Byzantium (Atlantis) onwards specific tests so it includes a specification added that is not included in ETC. Best guess is that it has something to do with accounts/abi/abi.go or related files.

Random test skips:

	skipTests["randomStatetest642.json"] = "random unimplemented"
	skipTests["randomStatetest644.json"] = "random unimplemented"
	skipTests["randomStatetest645.json"] = "random unimplemented"
	skipTests["Opcodes_TransactionInit.json/Byzantium/37"] = "random unimplemented"
	skipTests["Opcodes_TransactionInit.json/Byzantium/38"] = "random unimplemented"
	skipTests["Opcodes_TransactionInit.json/Byzantium/125"] = "random unimplemented"
	skipTests["Opcodes_TransactionInit.json/Byzantium/126"] = "random unimplemented"

Assuming these are all due to the unimplemented Atlantis functionality, should be revisited on implementing each opcode or at the end of Atlantis implementation

State trie clearing implementation detail

When completing the revert opcode, there were two test cases, which performed very similar logic that did not error because of REVERT at all and had mentioned being a state trie clearing test in one the filler test files (FailedCreateRevertsDeletion).

The two test files are:
FailedCreateRevertsDeletion.json
RevertPrefoundEmptyOOG.json

The scenario that both encounter is the following:
transaction calls A -> A creates X -> A hits error (OOG or intentional invalid opcode)

and my assumption is that either the empty contract that is created, X, isn't deleted OR the transaction state isn't reverted to the proper state at the start of the transaction.

edit: almost certain it is state trie clearing since the pre-byzantium tests pass on ETC

So either it is a missed edge case of state trie clearing, or an invalid existing implementation of state rollback within the existing ETC code.

I will look into this later, but documenting for now.

Here is the evm logs for both transactions (from ETH because they are cleaner than manually printing variables on ETC and the values are the same as the only difference is the accounts in post):

 --- PASS: TestState/RevertPrefoundEmptyOOG.json/Byzantium/0 (0.00s)
            state_test.go:107: EVM operation log:
                {"pc":0,"op":96,"gas":"0x11940","gasCost":"0x0","memory":"0x","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":2,"op":96,"gas":"0x1193d","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0x20"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":4,"op":96,"gas":"0x1193a","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0x20","0x0"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":6,"op":240,"gas":"0x11937","gasCost":"0x7d03","memory":"0x","memSize":32,"stack":["0x20","0x0","0x0"],"depth":1,"refund":0,"opName":"CREATE","error":""}
                {"pc":0,"op":0,"gas":"0x99c4","gasCost":"0x0","memory":"0x","memSize":0,"stack":[],"depth":2,"refund":0,"opName":"STOP","error":""}
                {"pc":7,"op":96,"gas":"0x9c34","gasCost":"0x7d03","memory":"0x","memSize":32,"stack":["0x7db299e0885c85039f56fa504a13dd8ce8a56aa7"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":9,"op":85,"gas":"0x9c31","gasCost":"0x4e20","memory":"0x","memSize":32,"stack":["0x7db299e0885c85039f56fa504a13dd8ce8a56aa7","0x0"],"depth":1,"refund":0,"opName":"SSTORE","error":""}
                {"pc":10,"op":96,"gas":"0x4e11","gasCost":"0x4e20","memory":"0x","memSize":32,"stack":[],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":12,"op":96,"gas":"0x4e0e","gasCost":"0x4e20","memory":"0x","memSize":32,"stack":["0xc"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":14,"op":85,"gas":"0x4e0b","gasCost":"0x4e20","memory":"0x","memSize":32,"stack":["0xc","0x1"],"depth":1,"refund":0,"opName":"SSTORE","error":"out of gas"}
                {"output":"","gasUsed":"0x11940","time":1485275,"error":"out of gas"}

FailedCreateRevertsDeletion.json has a slightly different flow:
transaction calls A -> A creates X -> X reverts back to A -> A hits invalid opcode and errors out

--- FAIL: TestState/FailedCreateRevertsDeletion.json/Byzantium/0 (0.00s)
            state_test.go:90: post state root mismatch: got 15755176ef2d7beb091958c3328a07aa87ff5a911e8388c422f24b96dd34e1d7, want 4198bc14346b78f666445049893f68de17d21f892a1e2c2848b576ff0d80cb4a
            state_test.go:107: EVM operation log:
                {"pc":0,"op":48,"gas":"0xe2a40","gasCost":"0x0","memory":"0x","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"ADDRESS","error":""}
                {"pc":1,"op":80,"gas":"0xe2a3e","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0x6295ee1b4f6dd65047762f924ecd367c17eabf8f"],"depth":1,"refund":0,"opName":"POP","error":""}
                {"pc":2,"op":96,"gas":"0xe2a3c","gasCost":"0x0","memory":"0x","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":4,"op":128,"gas":"0xe2a39","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0xc"],"depth":1,"refund":0,"opName":"DUP1","error":""}
                {"pc":5,"op":96,"gas":"0xe2a36","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0xc","0xc"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":7,"op":96,"gas":"0xe2a33","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0xc","0xc","0x12"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":9,"op":57,"gas":"0xe2a30","gasCost":"0x9","memory":"0x","memSize":32,"stack":["0xc","0xc","0x12","0x0"],"depth":1,"refund":0,"opName":"CODECOPY","error":""}
                {"pc":10,"op":96,"gas":"0xe2a27","gasCost":"0x9","memory":"0x","memSize":32,"stack":["0xc"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":12,"op":96,"gas":"0xe2a24","gasCost":"0x9","memory":"0x","memSize":32,"stack":["0xc","0x0"],"depth":1,"refund":0,"opName":"PUSH1","error":""}
                {"pc":14,"op":240,"gas":"0xe2a21","gasCost":"0x7d00","memory":"0x","memSize":32,"stack":["0xc","0x0","0x0"],"depth":1,"refund":0,"opName":"CREATE","error":""}
                {"pc":0,"op":98,"gas":"0xd766d","gasCost":"0x0","memory":"0x","memSize":0,"stack":[],"depth":2,"refund":0,"opName":"PUSH3","error":""}
                {"pc":4,"op":96,"gas":"0xd766a","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0x112233"],"depth":2,"refund":0,"opName":"PUSH1","error":""}
                {"pc":6,"op":82,"gas":"0xd7667","gasCost":"0x6","memory":"0x","memSize":32,"stack":["0x112233","0x0"],"depth":2,"refund":0,"opName":"MSTORE","error":""}
                {"pc":7,"op":96,"gas":"0xd7661","gasCost":"0x6","memory":"0x","memSize":32,"stack":[],"depth":2,"refund":0,"opName":"PUSH1","error":""}
                {"pc":9,"op":96,"gas":"0xd765e","gasCost":"0x6","memory":"0x","memSize":32,"stack":["0x20"],"depth":2,"refund":0,"opName":"PUSH1","error":""}
                {"pc":11,"op":253,"gas":"0xd765b","gasCost":"0x0","memory":"0x","memSize":32,"stack":["0x20","0x0"],"depth":2,"refund":0,"opName":"REVERT","error":""}
                {"pc":15,"op":80,"gas":"0xdad0f","gasCost":"0x7d00","memory":"0x","memSize":32,"stack":["0x0"],"depth":1,"refund":0,"opName":"POP","error":""}
                {"pc":16,"op":254,"gas":"0xdad0d","gasCost":"0x7d00","memory":"0x","memSize":32,"stack":[],"depth":1,"refund":0,"opName":"Missing opcode 0xfe","error":"invalid opcode 0xfe"}
                {"output":"","gasUsed":"0xe2a40","time":250217,"error":"invalid opcode 0xfe"}

0 value transfer transaction causes bad block to be created in getc

Found unhealthy block #102249 (checking block=102249 without state, found nonabsent state for block #102248):

Block(#102249): Size: 647.00 B {
MinerHash: 89f33d5824cdd6dcf1a5008f0e3431e603e333e17f745106475dcf61cb6ef320
Header(fe5a8f2a97c6c795cc13d339be2638a9ff3401ea43006f4a6800fe0cd11cb691):
[
ParentHash: 8e67f1735feb10642b276dfa3934d02bdfc978fbd00680d886e8f9e4f80435b9
UncleHash: 1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347
Coinbase: b2ee81431c1bb2b6aa754c37b4757e066ecd5ed5
Root: a055aaffef1f09895ec558a3e4405f0bf585e51e9e135d4c1ae9e91395e59bfb
TxSha a0406479525ee52759f2e0534796db148437c8b03e878c64d1e232a8f7929f28
ReceiptSha: 056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2
Bloom: 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Difficulty: 1864060
Number: 102249
GasLimit: 8000000
GasUsed: 21000
Time: 1561593775
Extra: ؃ �geth�go1.10.4�linux
MixDigest: e46f635b7b3555208c7c1901f5b2e42d4ac0cc10db37eb3ec27058e50269184f
Nonce: 5da7d685a73d834f
]

caused by 0 value transaction:

TX(d57fabbe5835884559b6239be4aef6c2d9f1f82aa6791a81c35287e0cf966961)
Contract: false
From: 515e563eb27185f06f0e5c31752f51ea71ca2f88
To: c7a08e84bd46f0e740cfee2081d3933c929e2c54
Nonce: 0
GasPrice: 40000000000
GasLimit 8000000
Value: 0
Data: 0x
V: 0xa96
R: 0x374899042b7321e5f4624c239e40144ddb7d49a5b9dcc548569912c5f86c3ff3
S: 0x6d74e3efe7c3538144af771a3b6267c0f4821b1d8f1cd6a52346c8e6deaf4f59
Hex: f867808509502f9000837a120094c7a08e84bd46f0e740cfee2081d3933c929e2c548080820a96a0374899042b7321e5f4624c239e40144ddb7d49a5b9dcc548569912c5f86c3ff3a06d74e3efe7c3538144af771a3b6267c0f4821b1d8f1cd6a52346c8e6deaf4f59
]
Uncles:
[]
}

Probably caused by missing state-trie clearing details.

Kotti Classic & ECIP-1060 Cliquey Upgrade Tracker

low priority, but at some point we want to have testnet support for Kotti Classic

ref goerli/eips-poa#12 ethereumclassic/ECIPs#72 ethereumclassic/ECIPs#74 ethereum/EIPs#1955

Cliquey is a proposed upgrade to Clique based networks, esp. Kotti Classic and Goerli.

Review Spec

Implement Upgrades

Cant install following README.md

Hey

Environment:
Ubuntu 18.04 LTS
GO : 1.12.6

I'm trying to install latest release (Geth Classic v6.0.6-beta), but failing on the first step.

geth-user@ip-172-31-31-232:~/distro/getc$ make build
go: github.com/huin/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/gizak/[email protected]+incompatible: mkdir /home/geth-user: permission denied
go: github.com/eth-classic/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/fatih/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/boltdb/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/syndtr/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/mailru/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/peterh/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/eth-classic/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/jackpal/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/stretchr/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/spf13/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/denisbrodbeck/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/rcrowley/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/eth-classic/go-ethereum/accounts/abi/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/hashicorp/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/maruel/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/rs/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/robertkrimen/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/rjeczalik/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/davecgh/[email protected]: mkdir /home/geth-user: permission denied
go: github.com/mattn/[email protected]: mkdir /home/geth-user: permission denied
go: golang.org/x/[email protected]: mkdir /home/geth-user: permission denied
go: golang.org/x/[email protected]: mkdir /home/geth-user: permission denied
go: golang.org/x/[email protected]: mkdir /home/geth-user: permission denied
go: golang.org/x/[email protected]: mkdir /home/geth-user: permission denied
go: gopkg.in/karalabe/[email protected]: mkdir /home/geth-user: permission denied
go: gopkg.in/[email protected]: mkdir /home/geth-user: permission denied
go: gopkg.in/fatih/[email protected]: mkdir /home/geth-user: permission denied
go: gopkg.in/urfave/[email protected]: mkdir /home/geth-user: permission denied
go: error loading module requirements

  • Also please mention required version of Go in README.md. Default version on ubuntu is 1.10 and that was failing with other error message (paths related).,
    I could run to next error after manually installing 1.12, lost some time trying to fix them and finally just to understand that version isn't latest.

Thanks

ECIP-1056 - Agharta Hardfork Tracker

ref etclabscore/ECIPs#13 (and #1)

After Atlantis #18 comes Agharta.

Review Spec

Implement Upgrades

  • Add Agharta transition/config that activates at
    • 1_500_000 on Kotti Classic PoA-testnet (early November 2019)
    • 5_200_000 on Morden Classic PoW-testnet (early November 2019)
    • 9_200_000 on Ethereum Classic PoW-mainnet (early December 2019)
  • Implement the proposals

Edit Daniel-1: Add checkboxes to tasks

Config for mainnet/testnet

So setting up the config outside of tests should be very straightforward, all that needs to be done is adding the atlantis fork to core/config/mainnet.json:

"forks": [
            ...
            {
                "name": "Atlantis",
                "block": 8750000,
                "features": [
                    {
                        "id": "difficulty",
                        "options": {
                            "type": "atlantis"
                        }
                    }
                ]
            }
        ],

The config for difficulty looks for the feature with id: "difficulty" and type for the name of the fork/name of feature (in code it is checking for "atlantis"). For checking IsAtlantis() for implementation features, the "name": "Atlantis", is referenced here:

func (c *ChainConfig) IsAtlantis(num *big.Int) bool {
	fork := c.ForkByName("Atlantis")
	if fork.Block == nil || num == nil {
		return false
	}
	return num.Cmp(fork.Block) >= 0
}

These should be the only details necessary for the config to be set up. I had tested the functionality of this config already when testing difficulty with this in tests/init.go:

		Forks: []*core.Fork{
			{
				Name:  "Atlantis",
				Block: big.NewInt(0),
				Features: []*core.ForkFeature{
					{
						ID: "difficulty",
						Options: core.ChainFeatureConfigOptions{
							"type": "atlantis",
						},
					},
				},
			},
		},

(There was a "length": 3000000, parameter, but this was unused and unnecessary and can be removed from the test config as it only affected the delay of difficulty bomb in ecip1010)

NOTE: When done modifying the json file, run

make chainconfig

to generate the assets that are referenced when running geth

We can just use this or expand on it to get our own testnet set up/ set up Kotti. I tested it using our client and it recognizes the Atlantis fork and can assume it functions correctly because of the testing.

[WIP] Atlantis Testnet & Mainnet Strategy

NOTE: this is preparation for our geth client. References to Parity are meant to be local changes for testing, not to Parity's actual repository.

In preparation for Atlantis(#18) we will need to ensure we have properly set our config(#39) for both Morden and Mainnet. Tentatively, it looks like we will be triggering the Mainnet launch much earlier (early-mid July) and the testnet this week. I have outlined a proposed go to launch strategy and more than open to suggestions:

  • 1. Update Configurations (Parity and Geth)
    • 1. Update mainnet Atlantis block number to 8,500,000
    • 2. Update Morden Atlantis block number to 4,729,274
  • 2. Network Simulations
    • 1. Test locally Geth<>Geth
    • 2. Test with a cloud instance of Geth<>Geth
    • 3. Test locally with a Geth<>Parity
    • 4. Test with a cloud instance of Geth (cloud) <> Parity (local)
  • 3. Testnet
    • 1. Spin up ~3 Geth nodes in the cloud (Digital Ocean) for a persistent network
    • 2. Ensure that the Atlantis has triggered
    • 3. IFF all is well, tear down network, connect to the existing Morden network
    • 4. IFF all is well, get boot node and distribute to other miners (Morden Network)
    • 5. IFF all is well for X days, proceed with mainnet
  • 4. Mainnet
    • IFF all goes smooth in the testnet, proceed with mainnet.
    • 1. Get participating mainnet nodes in a group(?)
    • 2. Give them constant updates on testnet progress
    • 3. Have them update X days prior to launch(?)
    • 4. IFF no bugs arise during the testnet proceed to mainnet

Edit: re-ordered a few items and added the note.

Discussion/question: squashed history

The "first" commit of this repo 60d03d4 explains that it "removes a large binary file from history." A couple of questions:

  • What file?
  • IMO this presents a nagging security/reviewablity concern, given the size and complexity of the codebase. Has this been considered? (Especially in light of newly published binary releases)? Might there be another way to remove the file without also removing the entire history? Or a proof of an equivalent code state comparison (minus 1 file) against the original code base and history?

Build config including sputnikvm

TL;DR: To build the project until all of the config is set up, run make build WITH_SVM=0 which builds without the sputnikvm

So I have been looking into the config since the build has been working not as intended since the namespace move and move to go modules.

Currently in the development branch, the build and running of geth will work by running:

make build WITH_SVM=0

With the current version, make build with assuming the sputnikvm config (since WITH_SVM defaults to 1) fails with clang errors such as one I ran into (but not limited to):

Undefined symbols for architecture x86_64:
  "_sputnikvm_out_copy_data", referenced from:
      __cgo_b01fc125d595_Cfunc_sputnikvm_out_copy_data in _x002.o
     (maybe you meant: __cgo_b01fc125d595_Cfunc_sputnikvm_out_copy_data)
  "_sputnikvm_out_len", referenced from:
      __cgo_b01fc125d595_Cfunc_sputnikvm_out_len in _x002.o
     (maybe you meant: __cgo_b01fc125d595_Cfunc_sputnikvm_out_len)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [cmd/geth] Error 2

Other errors I had run into had referenced multiple declarations of variables, also in the same process.

I was able to run with sputnikvm with go modules by editing all paths from the ETCDEVTeam/... to a cloned version where I edited the references in that repository to the eth-classic/go-ethereum since the ETCDEVTeam/sputnikvm-ffi references ethereumproject/go-ethereum (Also because their version is broken). I also changed the build_sputnikvm.sh file to access the go-ethereum code not from specifically the $GOPATH and also cloned the sputnikvm-ffi repository and referenced that folder to run that build.

A guess I have into why the c linker has been failing is with the -ldflags inside of the Makefile:

LDFLAGS=-ldflags "-X main.Version="`git describe --tags`

Since it is referenced in essentially every build command and the git describe --tags returns fatal: No names found, cannot describe anything since our cloned repository has no released versions that are tagged.

As per a comment in the code:

// Version is the application revision identifier. It can be set with the linker
// as in: go build -ldflags "-X main.Version="`git describe --tags`

Depending on how you run the code with sputnikvm, it may add ethereumproject/go-ethereum as an indirect reference because ETCDEVTeam sputnikvm-ffi references the common package of go-ethereum. As I have mentioned before, go-ethereum had referenced the go code of sputnikvm-ffi and vice versa and the Rust build was run during the go-ethereum build to build the executable which is used in a flag during the build of geth specifically (at the end of the build_sputnikvm.sh file).

EIP 145 - Test failure

In Test (TestAllETH/stShift/shiftCombinations.json/Constantinople/0), the test is failing.
Post state root error. Expected: f5fb373eddddb47243a41cf4b8a7cdc73a74b6a9a1ea38d31a9687beb4d550d7 have: bf7fd4c190a16b5521258dc8322686ffc115729df263be81b7b0ab54ea67a383

All other tests pass, including this one with ConstantinopleFix.

Update filepath

The go file path should be updated to reflect this repository.

Geth Attach Does Not Work

The command geth attach <ipc> does not work. The OS is Ubuntu 18.04 using the development branch.

Output:

>root@whiteblock-node1:/geth/kensington# geth attach geth.ipc 
>I0617 16:26:00.830741 consolecmd.go:135] attach to remote geth: unsupported RPC schema "geth.ipc"

The command that was run was to start geth was:

> geth --datadir=/geth/ --maxpeers=1000 --chain=/geth/chain.json --rpc --nodiscover --rpcaddr=10.1.0.18 --rpcapi=admin,web3,db,eth,net,personal,miner,txpool --rpccorsdomain=0.0.0.0 --mine --unlock=0x4f20516735b3c786c5e3c2b64d4201d121191f49,0x9dfc39f5f9c25892d1424c43b2d45b305a129180,0x7dd9e6843dbdaded6485cfdc2f95d94657bf4834 --password=/geth/passwd --etherbase=0x9dfc39f5f9c25892d1424c43b2d45b305a129180 console

Transactions causes split with Parity

This:

> personal.unlockAccount(eth.coinbase)
Unlock account 0x451122a4f0b6c0876d4b28643b04f53435182f71
Passphrase: 
true
> {from:eth.coinbase, to:'0x8b282d2123e77b9bc4b83eb732175e0406f3354a', value: web3.toWei(100, "ether"), gas:21000});
"0xda80a9ecc8d151a09bf715df035d3b91733ff668c78775e478c22d29b92460da"
> 

Caused this:

2019-06-11 20:11:38  Imported #10981 0x52e6…5f5d (0 txs, 0.00 Mgas, 0 ms, 0.50 KiB)
2019-06-11 20:11:40  Imported #10982 0xbbd9…4fe9 (0 txs, 0.00 Mgas, 0 ms, 0.50 KiB)
2019-06-11 20:12:08     3/25 peers   371 KiB chain 4 MiB db 0 bytes queue 539 KiB sync  RPC:  0 conn,    0 req/s,    0 µs
2019-06-11 20:12:10  Stage 5 block verification failed for #10983 (0x39b2…14c4)
Error: Error(Block(InvalidReceiptsRoot(Mismatch { expected: 0x3519d32b9b94bb3c471361ba8d2b34352cb67c47ad0691a387daa995dfc0f347, found: 0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2 })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
2019-06-11 20:12:10  
Bad block detected: Error(Block(InvalidReceiptsRoot(Mismatch { expected: 0x3519d32b9b94bb3c471361ba8d2b34352cb67c47ad0691a387daa995dfc0f347, found: 0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2 })), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })
RLP: f90272f901fba0bbd92f55c08cf2eb89f0a96e70205259538c8f4c6b649762e394b1cdaa9c4fe9a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347943df1fc3a01d8a15a6aa4c95bf12f7631619996f1a0d551430df607393d31ff064ac39a52f0ca79f0bc6e7f53275b85214cf0e9ab01a08d1a812bcce43beddffa59165f59487e04604625cc6dc776753459267638c057a03519d32b9b94bb3c471361ba8d2b34352cb67c47ad0691a387daa995dfc0f347b90100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008317ba32822ae78347e7c4825208845cffeedc80a0d0154ad7318ff84466056ed40353f0f136b3fcdefb81ceea7d4dbbc6622c535b885b9f661ffde1b8aaf871f86f808504a817c800825208948b282d2123e77b9bc4b83eb732175e0406f3354a89056bc75e2d6310000080820a95a0cebcb1a24546dac41c2c949cbde4b4981891d2a38e27702eb73c541d6812980da04205d0dd175a42a3062d055277ac5290c40e45ce8c2710b7b812abfc1efccd5ec0
Header: Header { parent_hash: 0xbbd92f55c08cf2eb89f0a96e70205259538c8f4c6b649762e394b1cdaa9c4fe9, timestamp: 1560276700, number: 10983, author: 0x3df1fc3a01d8a15a6aa4c95bf12f7631619996f1, transactions_root: 0x8d1a812bcce43beddffa59165f59487e04604625cc6dc776753459267638c057, uncles_hash: 0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, extra_data: [], state_root: 0xd551430df607393d31ff064ac39a52f0ca79f0bc6e7f53275b85214cf0e9ab01, receipts_root: 0x3519d32b9b94bb3c471361ba8d2b34352cb67c47ad0691a387daa995dfc0f347, log_bloom: 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, gas_used: 21000, gas_limit: 4712388, difficulty: 1554994, seal: [[160, 208, 21, 74, 215, 49, 143, 248, 68, 102, 5, 110, 212, 3, 83, 240, 241, 54, 179, 252, 222, 251, 129, 206, 234, 125, 77, 187, 198, 98, 44, 83, 91], [136, 91, 159, 102, 31, 253, 225, 184, 170]], hash: Some(0x39b26e69c709287ebec0007440cc5c1ad73b06a98f4777fe8dc73aaca3d114c4) }
Uncles: 
Transactions:[Tx 0] UnverifiedTransaction { unsigned: Transaction { nonce: 0, gas_price: 20000000000, gas: 21000, action: Call(0x8b282d2123e77b9bc4b83eb732175e0406f3354a), value: 100000000000000000000, data: [] }, v: 2709, r: 93509840040241650265440443168223529970091543351406337441313959923251951081485, s: 29862923765667133073992970208953758916573727840587042244033021498471560826206, hash: 0xda80a9ecc8d151a09bf715df035d3b91733ff668c78775e478c22d29b92460da }

2019-06-11 20:12:38     0/25 peers   371 KiB chain 4 MiB db 0 bytes queue 539 KiB sync  RPC:  0 conn,    0 req/s,    0 µs
2019-06-11 20:13:08     0/25 peers   371 KiB chain 4 MiB db 0 bytes queue 539 KiB sync  RPC:  0 conn,    0 req/s,    0 µs
2019-06-11 20:13:38     0/25 peers   371 KiB chain 4 MiB db 0 bytes queue 539 KiB sync  RPC:  0 conn,    0 req/s,    0 µs
2019-06-11 20:14:08     0/25 peers   371 KiB chain 4 MiB db 0 bytes queue 539 KiB sync  RPC:  0 conn,    0 req/s,    0 µs

PR Reviews

I'd like to increase the threshold for PR review from 1 to 3.

That being said, I would like @noot to approve all PR's (for consistency) one of myself or @soc1c and third from any other contributor (@Aabell8, @dziabko, @steviezhang or @priom).

Rational

I would like that everyone on the team understands the on going changes to the code base.

ECIP 1054 - Atlantis Hardfork Tracker

I don't want to mess with #1, but I would suggest creating tracking issues for each milestone of Ethereum Classic, here: ECIP 1054 - Atlantis

Review Spec

Implement Upgrades

  • Add Atlantis transition/config that activates at
    • 1_039_000 on Kotti Classic PoA-testnet (early August 2019)
    • 4_723_000 on Morden Classic PoW-testnet (early August 2019)
    • 8_750_000 on Ethereum Classic PoW-mainnet (mid-September 2019)
  • Implement the proposals
    • EIP 100 (Change difficulty adjustment to target mean block time including uncles) #36
    • EIP 140 (REVERT instruction in the Ethereum Virtual Machine) #34
    • EIP 161 (State-trie clearing) #28
    • EIP 170 (Contract-code size limit) #23
    • EIP 196 (Precompiled contracts for addition and scalar multiplication on the elliptic curve alt_bn128) #24
    • EIP 197 (Precompiled contracts for optimal ate pairing check on the elliptic curve alt_bn128) #24
    • EIP 198 (Precompiled contract for BIGINT modular exponentiation) #24
    • EIP 211 (New opcodes RETURNDATASIZE and RETURNDATACOPY) #37
    • EIP 214 (New opcode STATICCALL) #40
    • EIP 658 (Embedding transaction status code in receipts) #62

core/block_validator.go#calcDifficultyAtlantis is wrong

https://github.com/eth-classic/go-ethereum/blob/development/core/block_validator.go#L362

At first review this appears to use a hardcoded bomb delay value according to EIP1234, which is not relevant to ETC nor Atlantis.

Atlantis occurs canonically after ECIP1010 (difficulty bomb defuse), which makes this spec and logic inapplicable.

func calcDifficultyAtlantis(time uint64, parent *types.Header) *big.Int {
	bombDelayFromParent := new(big.Int).Sub(big.NewInt(3000000), big1)
	// https://github.com/ethereum/EIPs/issues/100.
	// algorithm:
	// diff = (parent_diff +
	//         (parent_diff / 2048 * max((2 if len(parent.uncles) else 1) - ((timestamp - parent.timestamp) // 9), -99))
	//        ) + 2^(periodCount - 2)

	bigTime := new(big.Int).SetUint64(time)
	bigParentTime := parent.Time

	// holds intermediate values to make the algo easier to read & audit
	x := new(big.Int)
	y := new(big.Int)

	// (2 if len(parent_uncles) else 1) - (block_timestamp - parent_timestamp) // 9
	x.Sub(bigTime, bigParentTime)
	x.Div(x, big9)
	if parent.UncleHash == types.EmptyUncleHash {
		x.Sub(big1, x)
	} else {
		x.Sub(big2, x)
	}
	// max((2 if len(parent_uncles) else 1) - (block_timestamp - parent_timestamp) // 9, -99)
	if x.Cmp(bigMinus99) < 0 {
		x.Set(bigMinus99)
	}
	// parent_diff + (parent_diff / 2048 * max((2 if len(parent.uncles) else 1) - ((timestamp - parent.timestamp) // 9), -99))
	y.Div(parent.Difficulty, params.DifficultyBoundDivisor)
	x.Mul(y, x)
	x.Add(parent.Difficulty, x)

	// minimum difficulty can ever be (before exponential factor)
	if x.Cmp(params.MinimumDifficulty) < 0 {
		x.Set(params.MinimumDifficulty)
	}
	// calculate a fake block number for the ice-age delay
	// Specification: https://eips.ethereum.org/EIPS/eip-1234
	fakeBlockNumber := new(big.Int)
	if parent.Number.Cmp(bombDelayFromParent) >= 0 {
		fakeBlockNumber = fakeBlockNumber.Sub(parent.Number, bombDelayFromParent)
	}
	// for the exponential factor
	periodCount := fakeBlockNumber
	periodCount.Div(periodCount, expDiffPeriod)

	// the exponential factor, commonly referred to as "the bomb"
	// diff = diff + 2^(periodCount - 2)
	if periodCount.Cmp(big1) > 0 {
		y.Sub(periodCount, big2)
		y.Exp(big2, y, nil)
		x.Add(x, y)
	}
	return x
}

use of internal package not allowed

~/.opt/getc elizabeth/import-paths
❯ go test ./...
console/console.go:30:2: use of internal package github.com/eth-classic/go-ethereum/internal/jsre not allowed
console/console.go:31:2: use of internal package github.com/eth-classic/go-ethereum/internal/web3ext not allowed

revealed by #4

inherited from the ethereumproject which suffers the same

~/.opt/go-ethereum master
❯ go test ./...
console/console.go:30:2: use of internal package github.com/ethereumproject/go-ethereum/internal/jsre not allowed
console/console.go:31:2: use of internal package github.com/ethereumproject/go-ethereum/internal/web3ext not allowed

go 1.12

❯ go version
go version go1.12.1 linux/amd64

Stable version before Atlantis hard fork

This is more of a question than an issue. Are you guys going to release a stable version before the Atlantis hard fork on mainnet, and if so, is there any schedule of when should I expect it to come out?

Consensus issue with how/ what CALL operations touch accounts to be deleted

For context, EIP 158/161 touches any accounts through any CALL type operations with a zero value transfer (CALL, DELEGATECALL, CALLCODE), which marks them for deletion at the end of the transaction if they are still empty objects. Empty objects is defined as having 0 balance, nonce, code, and storage.

Currently in ETH Geth, there is an intentional touch on STATICCALL implementation that causes a touch (there is no functional need for this because STATICCALL is explicitly a non-state changing operation) but also CALLCODE and DELEGATECALL currently on ETC transfer a value of 0 since it is a shared exec(...) function, which causes a touch. This did not matter previously (or when all empty object will be deleted) because the behaviour would be consistent.

The consensus issue made most explicit is if the clients make a STATICCALL operation to an empty account at an address and that transaction runs OOG, the different clients will disagree with which empty accounts will be deleted. This is not obvious by tests because the tests prior and including Byzantium did not expose this change, but a lot of the Constantinople tests do (maybe a reason to follow this strange implementation)

On ETH Geth, they are currently expecting the failure of certain tests because of their implementation:

	// Expected failures:
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/0`, "bug in test")
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Byzantium/3`, "bug in test")
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/0`, "bug in test")
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/Constantinople/3`, "bug in test")
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/0`, "bug in test")
	st.fails(`^stRevertTest/RevertPrecompiledTouch(_storage)?\.json/ConstantinopleFix/3`, "bug in test")

For reference here is what these tests call inside the test in assembly:

(Explained in plain english each test is calling all of the precompile addresses with 0 value with different CALL operation types)

0: CALL)

"code" : "{ (CALL 50000 1 0 0 0 0 0) (CALL 50000 2 0 0 0 0 0) (CALL 50000 3 0 0 0 0 0) (CALL 50000 4 0 0 0 0 0) (CALL 50000 5 0 0 0 0 0) (CALL 50000 6 0 0 0 0 0) (CALL 50000 7 0 0 0 0 0) (CALL 50000 8 0 0 0 0 0) [[1]] (GAS) [[2]] (GAS) [[3]] (GAS) }",

3: STATICCALL)

"code" : "{ (STATICCALL 50000 1 0 0 0 0) (STATICCALL 50000 2 0 0 0 0) (STATICCALL 50000 3 0 0 0 0) (STATICCALL 50000 4 0 0 0 0) (STATICCALL 50000 5 0 0 0 0) (STATICCALL 50000 6 0 0 0 0) (STATICCALL 50000 7 0 0 0 0) (STATICCALL 50000 8 0 0 0 0) [[1]] (GAS) [[2]] (GAS) [[3]] (GAS) }",

and for reference, the two tests that pass and expect to pass:

1: DELEGATECALL)

"code" : "{ (DELEGATECALL 50000 1 0 0 0 0) (DELEGATECALL 50000 2 0 0 0 0) (DELEGATECALL 50000 3 0 0 0 0) (DELEGATECALL 50000 4 0 0 0 0) (DELEGATECALL 50000 5 0 0 0 0) (DELEGATECALL 50000 6 0 0 0 0) (DELEGATECALL 50000 7 0 0 0 0) (DELEGATECALL 50000 8 0 0 0 0) [[1]] (GAS) [[2]] (GAS) [[3]] (GAS) }",

2: CALLCODE)

"code" : "{ (CALLCODE 50000 1 0 0 0 0 0) (CALLCODE 50000 2 0 0 0 0 0) (CALLCODE 50000 3 0 0 0 0 0) (CALLCODE 50000 4 0 0 0 0 0) (CALLCODE 50000 5 0 0 0 0 0) (CALLCODE 50000 6 0 0 0 0 0) (CALLCODE 50000 7 0 0 0 0 0) (CALLCODE 50000 8 0 0 0 0 0) [[1]] (GAS) [[2]] (GAS) [[3]] (GAS) }",

Which all four of these tests pass if the explicit touch on ETH is removed.

To clarify, this implementation caused the tests to fail and ETH expected those tests to fail in order to remain in consensus with Parity on the main net chain

This is a bad reason to follow this implementation, but would make testing Agharta much easier since all tests expect this behaviour now, and it does not functionally change anything once all existing empty objects are deleted (though it may have an effect if somehow a way to initialize empty accounts surfaces through a bug).

Another issue is that currently the implementations in Parity and ETH geth is that address 0x00...03 an exception to which addresses are cleared for being empty due to the issue with that precompile being deleted on main net when all empty accounts were touch deleted after the implementation of 161.
https://github.com/ethereum/go-ethereum/blob/master/core/state/journal.go#L165
This edge case was implemented at some point in some in progress merges into ETC geth despite the fact that it had no meaning on Ethereum Classic network.

Discussion of related topics referenced, on main net

Tying into this, we see a similar potential issue in address 0x5, where it may have been initialized from non-existant -> empty this would present a similar issue to what occured with address 0x3 if it is subject to the same edge case if we would presumably want to align ourselves with the parity implementation? (this could be resolved by sending a minimal balance to this address)

Tracking EIPS

Current research on the EIPS can be found under the ./research directory. To avoid bloating this issue I'll leave those notes there, further discussions should occur here. It should be noted that the research includes code snippets from www.github.com/ethereum/go-ethereum.

It was noted by @Aabell8 that go-ethereum has a different file structure than etc-ethereum, nonetheless the code snippets are still useable.

We should also cross reference ETC upcoming hardfork Atlantis - as pointed out by @soc1c

We will first complete ALL Atlantis EIPs then do the remaining afterwards!

Task Atlantis Assigned TO PR #
YES @Aabell8
YES @Aabell8
YES @steviezhang #28
YES @steviezhang #23
YES @noot #24
YES @noot #24
YES @noot #24
YES @Aabell8 #13
YES @Aabell8 #22
YES @Aabell8
  • ZK-Snarks
NO N/A
  • RSA Signatures
NO N/A

EIPS:

  • EIP 100 Changes to the difficulty adjustment formula to take uncles into account ()
  • EIP 140 Addition of 'REVERT' opcode, to permit error handling without consuming all gas
  • EIP 196 Elliptic curve addition and scalar multiplication on alt_bn128
  • EIP 197 Pairing checks
  • EIP 198 Support for big integer modular exponentiation
  • EIP 211 Support for variable length return values ()
  • EIP 214 Addition of the 'STATICCALL' opcode, permitting non-state-changing calls to other contracts
  • EIP 658 Transaction receipts to include a status field to indicate success or failure

Pre-compiles

  • ZK-Snarks and other cryptographic mathemagic™

Nice to haves:

  • Enabling RSA signature verification and other cryptographic applications

Edit 1 - Update description and added references to Atlantis hard fork
Edit 2 - Organized the EIPS by number
Edit 3 - Added Atlantis EIP's

core/block_validator.go#calcDifficultyAtlantis: should not use hardcoded bomb delay

https://github.com/eth-classic/go-ethereum/blob/development/core/block_validator.go#L326

func calcDifficultyAtlantis(time uint64, parent *types.Header) *big.Int {
	bombDelayFromParent := new(big.Int).Sub(big.NewInt(3000000), big1)
	// https://github.com/ethereum/EIPs/issues/100.
	// algorithm:
	// diff = (parent_diff +
	//         (parent_diff / 2048 * max((2 if len(parent.uncles) else 1) - ((timestamp - parent.timestamp) // 9), -99))
	//        ) + 2^(periodCount - 2)

	bigTime := new(big.Int).SetUint64(time)
	bigParentTime := parent.Time

	// holds intermediate values to make the algo easier to read & audit
	x := new(big.Int)
	y := new(big.Int)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.