Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/mess #7

Open
wants to merge 114 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
54add42
cmd/geth/tests: try to fix spurious travis failure in les tests (#21410)
holiman Aug 14, 2020
f3bafec
metrics: make meter updates lock-free (#21446)
MariusVanDerWijden Aug 18, 2020
2ff464b
core/state: fixed some comments (#21450)
Neurone Aug 19, 2020
32b078d
build: drop disco, enable groovy on Ubuntu PPAs
karalabe Aug 19, 2020
560d444
Merge pull request #21461 from karalabe/ppa-drop-disco
karalabe Aug 19, 2020
7ebc6c4
cmd/evm: statet8n output folder + tx hashes on trace filenames (#21406)
holiman Aug 19, 2020
0bdd295
core: more detailed metering for reorgs (#21420)
MariusVanDerWijden Aug 20, 2020
8cbdc86
core: define and test chain rewind corner cases (#21409)
karalabe Aug 20, 2020
15fdaf2
travis, dockerfile, appveyor, build: bump to Go 1.15
karalabe Aug 20, 2020
a70a79b
Merge pull request #21466 from karalabe/go1.15
karalabe Aug 20, 2020
4e54b1a
metrics: zero temp variable in updateMeter (#21470)
MariusVanDerWijden Aug 21, 2020
9f7b79a
eth/downloader: fix rollback issue on short chains
holiman Aug 21, 2020
b68929c
Merge pull request #21472 from holiman/fix_dltest_fail
karalabe Aug 21, 2020
87c0ba9
core, eth, les, trie: add a prefix to contract code (#21080)
rjl493456442 Aug 21, 2020
1b5a867
core: do less lookups when writing fast-sync block bodies (#21468)
holiman Aug 22, 2020
0f4e7c9
eth: utilize sync bloom for getNodeData (#21445)
holiman Aug 24, 2020
3ee91b9
core/state/snapshot: reduce disk layer depth during generation
karalabe Aug 24, 2020
bdde616
Merge pull request #21477 from karalabe/snapshotter-shallow-generator
karalabe Aug 24, 2020
7b5107b
p2p/discover: avoid dropping unverified nodes when table is almost em…
timcooijmans Aug 24, 2020
5655dce
core/rawdb: only complain loudly if truncating many items
karalabe Aug 25, 2020
d13b8e5
Merge pull request #21483 from karalabe/freezer-truncate-silent
karalabe Aug 25, 2020
341f451
graphql: add support for retrieving the chain id (#21451)
islishude Aug 25, 2020
ce5f949
params: update CHTs for v1.9.20 release
karalabe Aug 25, 2020
63a9d4b
Merge pull request #21486 from karalabe/cht-1.9.20
karalabe Aug 25, 2020
979fc96
params: release Geth v1.9.20
fjl Aug 25, 2020
fc20680
params: begin v1.9.21 release cycle
fjl Aug 25, 2020
92b12ee
accounts/abi/bind/backends: Disallow AdjustTime for non-empty blocks …
MariusVanDerWijden Aug 26, 2020
d8da0b3
core/state, eth, trie: stabilize memory use, fix memory leak
karalabe Aug 26, 2020
16d7eae
eth: updated comments (#21490)
MariusVanDerWijden Aug 26, 2020
856307d
go.mod | goleveldb latest update (#21448)
ucwong Aug 26, 2020
d97e006
Merge pull request #21491 from karalabe/state-sync-leak-fix
karalabe Aug 27, 2020
05280a7
eth/tracers: revert reason in call_tracer + error for failed internal…
libotony Aug 27, 2020
43529af
Merge remote-tracking branch 'foundation/master' into merge/foundatio…
meowsbits Aug 27, 2020
a6daef3
go mod tidy
meowsbits Aug 27, 2020
154b902
rawdb: fix import path FullImmutabilityThreshold
meowsbits Aug 27, 2020
3a9f942
core,rawdb,miner,tracers: remove unused imports
meowsbits Aug 27, 2020
64404d9
graphql: fix no method ChainId
meowsbits Aug 27, 2020
a5f7028
backends: fix TxGas not declared by package params
meowsbits Aug 27, 2020
c279b9a
core: fix types.DeriveSha sig use, test rollback->sethead
meowsbits Aug 27, 2020
dbfe59c
core: fix MustCommit Genesis calls
meowsbits Aug 27, 2020
297b3cb
rawdb,fetcher: (lint) goimports -w
meowsbits Aug 27, 2020
5d0928c
lib,core,rawdb,test.out: fix TestFastVsFullChains_RemoteFreezer
meowsbits Aug 27, 2020
bf84a9a
core: remove invalid test
meowsbits Aug 27, 2020
ede0a95
rawdb: (lint) goimports -w
meowsbits Aug 27, 2020
df0126c
rawdb: add missing import
meowsbits Aug 27, 2020
7269a17
core: fix initialization from freezer
meowsbits Aug 27, 2020
448fb71
core: add nil condition and comment for writeHeadBlock if bc empty
meowsbits Aug 28, 2020
e834039
params: bump version to v1.11.13-stable
meowsbits Sep 8, 2020
172c244
params: bump version to v1.11.14-unstable
meowsbits Sep 8, 2020
eb8bbb0
Merge pull request #179 from etclabscore/release/v1.11.13
iquidus Sep 9, 2020
4949222
core: refactor reorganization function and data
meowsbits Sep 10, 2020
7c86e18
core: refactor writeBlockWithState reorg logic
meowsbits Sep 10, 2020
468b152
core: init ecbp11355 (MESS) implementation
meowsbits Sep 10, 2020
9ea9d7e
core,coregeth,ctypes,genesisT,goethereum,multigeth,parity: init ECBP1…
meowsbits Sep 10, 2020
2718253
core: implement new blockReorgMeter in reorg method
meowsbits Sep 10, 2020
9d82e60
core,eth: implement AF safety mechanisms at sync level
meowsbits Sep 10, 2020
df45f0a
params: set MESS activation numbers for classic and mordor
meowsbits Sep 10, 2020
379294e
core,eth: refactor af enable/disable for cleaner logs
meowsbits Sep 10, 2020
c050c21
core: break af logic to own file
meowsbits Sep 10, 2020
2d2c979
:nail_care:
meowsbits Sep 10, 2020
9101fe5
params: default MessNet chain config and genesis
meowsbits Sep 10, 2020
295c436
core: increase logging precision for MESS outcome
meowsbits Sep 10, 2020
ec27ad4
core: case-based tests for easy/hard MESS chain acceptance
meowsbits Sep 10, 2020
2fa5056
eth: actually install artificialFinalitySafetyLoop goroutine
meowsbits Sep 10, 2020
ae203d2
params: add comments on ETA for classic and mordor MESS activations
meowsbits Sep 10, 2020
88d5439
core: increase MESS log precision to 5
meowsbits Sep 10, 2020
84b87dd
core: add more test cases showing approaching limits
meowsbits Sep 10, 2020
0268698
core,params: (lint): goimports -w
meowsbits Sep 10, 2020
a34bf53
core: refactor reorg logic in writeBlockWithState
meowsbits Sep 11, 2020
905564e
core: refactor and document fn alternatives, select sinusoidal
meowsbits Sep 11, 2020
26047a5
core,go.mod,go.sum: include test that makes graphs, and remove same s…
meowsbits Sep 11, 2020
94e7fed
forkid: update forkid tests with classic,mordor ecbp11355 activations
meowsbits Sep 11, 2020
d8c7680
.golangci.yml: include AF unused functions in allowed deadcode
meowsbits Sep 11, 2020
f66da3f
core: lint, add sin fn test
meowsbits Sep 11, 2020
49e02ff
core: re-include redundant reorg condition
meowsbits Sep 11, 2020
9ff67d4
core: (lint): goimports -w
meowsbits Sep 11, 2020
ccef362
forkid,confp: forkid skips BestPractice (BP) transitions
meowsbits Sep 11, 2020
6433598
core: improve and add AF log context when enabled
meowsbits Sep 11, 2020
b0f0144
params: no MESS activation set on ETC mainnet
meowsbits Sep 12, 2020
e3c5da3
core: refactor and tinker with logic around equivalent short reorg ac…
meowsbits Sep 12, 2020
c8234bb
eth,web3ext: install admin_ecbp11355 method
meowsbits Sep 12, 2020
e0cf2a0
main,utils: install --ecbp11355 flag for chain config overrides
meowsbits Sep 12, 2020
4fbe2d9
main,utils,core,eth,web3ext,params,coregeth,ctypes,genesisT,goethereu…
meowsbits Sep 12, 2020
52a0da1
params: (lint): goimports -w
meowsbits Sep 12, 2020
0c46755
confp: refactor method cross-compatibility namespacing logic
meowsbits Sep 12, 2020
5bc3fc2
core: fix typos, prettify ecbp1100 logging
meowsbits Sep 13, 2020
6c41aa0
core: swap sin for polynomial (cubic) fn
meowsbits Sep 17, 2020
e465842
core: add ECBP1100 arbitration logic to writeKnownBlock
meowsbits Sep 20, 2020
f1c300e
core: adds test TestAFKnownBlock
meowsbits Sep 21, 2020
493ec1d
core: use polynomial big int, refactor AF cond installation locales
meowsbits Sep 23, 2020
056c0fc
core: fix merge-missed minerOwn condition in AF arbiter
meowsbits Sep 23, 2020
93381ae
core: fix AF logging to be less talky
meowsbits Sep 23, 2020
5ef64c2
core: lowbump logging of MESS-approval to >2 segments
meowsbits Sep 23, 2020
6c01dad
core: skip development and graphing tests
meowsbits Sep 23, 2020
a294c66
core: add more illustrative tests for diffic/length scaling
meowsbits Sep 23, 2020
131ddf5
params: install classic ECBP1100 activation 11377500
meowsbits Sep 23, 2020
60b2831
core: uncomment int64 version of polynomialv fn
meowsbits Sep 23, 2020
1e7f628
core: (lint) goimports -w, unnecessary conversions
meowsbits Sep 23, 2020
ce11ef9
core: refactor minerOwn logic to be simpler
meowsbits Sep 23, 2020
98b9def
core,core/reorgs-MESS.png: use current time instead of proposed time …
meowsbits Sep 23, 2020
908be72
core: remove minerOwn logic from MESS arbitration
meowsbits Sep 23, 2020
0cb3d68
core/reorgs-MESS.png: remove graph file accidentally committed
meowsbits Sep 23, 2020
33f1812
params: fix etc mainnet MESS activation number
meowsbits Sep 24, 2020
427bf3b
core: only calc prettyRation when needed
meowsbits Sep 24, 2020
c15eecb
eth: bump stale-check safety interval to 30*13s
meowsbits Sep 24, 2020
15d4bf9
eth: bump MESS minpeers safety to 5 (defaultMinSyncPeers)
meowsbits Sep 24, 2020
5b63eb5
eth,goethereum: add test for protocolman AF features enable/disable
meowsbits Sep 25, 2020
36bb18e
core: remove vestigal int64 polynomial fn, rm emath import
meowsbits Sep 25, 2020
ab57ebb
core: tidy up test file
meowsbits Sep 25, 2020
4aceb86
core: update comment to use current instead of proposed
meowsbits Sep 25, 2020
b8bcdb8
eth: (lint) fix unecesssary use of Sprintf (gosimple)
meowsbits Sep 25, 2020
41ee136
goethereum: (lint) fix struct tag on nonexported field (govet)
meowsbits Sep 25, 2020
2f81f32
core: fix log value for proposed reorg span
meowsbits Sep 25, 2020
fbe85f3
params: update MESS block numbers for etc mainnet, mordor testnet
meowsbits Sep 25, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ issues:
- path: cmd/faucet/
linters:
- deadcode
- path: core/blockchain_af.go
linters:
- deadcode
37 changes: 26 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- stage: lint
os: linux
dist: xenial
go: 1.14.x
go: 1.15.x
env:
- lint
git:
Expand All @@ -18,10 +18,10 @@ jobs:

# Run core-geth -specific tests, proving regression-safety and config interoperability.
- stage: build
name: "Go1.14.x: make test-coregeth"
name: "Go1.15.x: make test-coregeth"
os: linux
dist: xenial
go: 1.14.x
go: 1.15.x
script:
- make test-coregeth

Expand All @@ -37,14 +37,26 @@ jobs:
- make all
- travis_wait 60 make test

# Run build and tests against latest-1 Go version.
- stage: build
name: "Go1.14.x: make test"
os: linux
dist: xenial
go: 1.14.x
env:
- GO111MODULE=on
script:
- make all
- travis_wait 60 make test

# Run build and tests on ARM64 on Pull Requests.
- stage: build
name: "ARM64/Go1.14.x: make test"
name: "ARM64/Go1.15.x: make test"
if: type = pull_request
os: linux
arch: arm64
dist: xenial
go: 1.14.x
go: 1.15.x
env:
- GO111MODULE=on
script:
Expand All @@ -53,10 +65,11 @@ jobs:

# Run build and tests with environment-aware possible artifact deployment.
- stage: build
name: "Go1.14.x: make test && deploy"
if: type = push
name: "Go1.15.x: make test && deploy"
os: linux
dist: xenial
go: 1.14.x
go: 1.15.x
script:
- make all
- travis_wait 60 make test
Expand All @@ -77,11 +90,12 @@ jobs:

# Run build on ARM5 with environment-aware possible artifact deployment.
- stage: build
name: "ARM5/Go1.14.x: go run build/ci.go install && deploy"
if: type = push
name: "ARM5/Go1.15.x: go run build/ci.go install && deploy"
os: linux
dist: xenial
sudo: required
go: 1.14.x
go: 1.15.x
env:
- ARMv5
git:
Expand Down Expand Up @@ -112,9 +126,10 @@ jobs:

#Run build on OSX with environment-aware possible artifact deployment.
- stage: build
name: "OSX/Go1.14.x: make all && deploy"
if: type = push
name: "OSX/Go1.15.x: make all && deploy"
os: osx
go: 1.14.x
go: 1.15.x
script:
- echo "Increase the maximum number of open file descriptors on macOS"
- NOFILE=20480
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build Geth in a stock Go builder container
FROM golang:1.14-alpine as builder
FROM golang:1.15-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.alltools
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build Geth in a stock Go builder container
FROM golang:1.14-alpine as builder
FROM golang:1.15-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

Expand Down
8 changes: 5 additions & 3 deletions accounts/abi/bind/backends/simulated.go
Original file line number Diff line number Diff line change
Expand Up @@ -678,14 +678,16 @@ func (b *SimulatedBackend) SubscribeNewHead(ctx context.Context, ch chan<- *type
}

// AdjustTime adds a time shift to the simulated clock.
// It can only be called on empty blocks.
func (b *SimulatedBackend) AdjustTime(adjustment time.Duration) error {
b.mu.Lock()
defer b.mu.Unlock()

if len(b.pendingBlock.Transactions()) != 0 {
return errors.New("Could not adjust time on non-empty block")
}

blocks, _ := core.GenerateChain(b.config, b.blockchain.CurrentBlock(), ethash.NewFaker(), b.database, 1, func(number int, block *core.BlockGen) {
for _, tx := range b.pendingBlock.Transactions() {
block.AddTx(tx)
}
block.OffsetTime(int64(adjustment.Seconds()))
})
statedb, _ := b.blockchain.State()
Expand Down
41 changes: 39 additions & 2 deletions accounts/abi/bind/backends/simulated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ func TestSimulatedBackend_AdjustTime(t *testing.T) {
defer sim.Close()

prevTime := sim.pendingBlock.Time()
err := sim.AdjustTime(time.Second)
if err != nil {
if err := sim.AdjustTime(time.Second); err != nil {
t.Error(err)
}
newTime := sim.pendingBlock.Time()
Expand All @@ -155,6 +154,44 @@ func TestSimulatedBackend_AdjustTime(t *testing.T) {
}
}

func TestNewSimulatedBackend_AdjustTimeFail(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
// Create tx and send
tx := types.NewTransaction(0, testAddr, big.NewInt(1000), vars.TxGas, big.NewInt(1), nil)
signedTx, err := types.SignTx(tx, types.HomesteadSigner{}, testKey)
if err != nil {
t.Errorf("could not sign tx: %v", err)
}
sim.SendTransaction(context.Background(), signedTx)
// AdjustTime should fail on non-empty block
if err := sim.AdjustTime(time.Second); err == nil {
t.Error("Expected adjust time to error on non-empty block")
}
sim.Commit()

prevTime := sim.pendingBlock.Time()
if err := sim.AdjustTime(time.Minute); err != nil {
t.Error(err)
}
newTime := sim.pendingBlock.Time()
if newTime-prevTime != uint64(time.Minute.Seconds()) {
t.Errorf("adjusted time not equal to a minute. prev: %v, new: %v", prevTime, newTime)
}
// Put a transaction after adjusting time
tx2 := types.NewTransaction(1, testAddr, big.NewInt(1000), vars.TxGas, big.NewInt(1), nil)
signedTx2, err := types.SignTx(tx2, types.HomesteadSigner{}, testKey)
if err != nil {
t.Errorf("could not sign tx: %v", err)
}
sim.SendTransaction(context.Background(), signedTx2)
sim.Commit()
newTime = sim.pendingBlock.Time()
if newTime-prevTime >= uint64(time.Minute.Seconds()) {
t.Errorf("time adjusted, but shouldn't be: prev: %v, new: %v", prevTime, newTime)
}
}

func TestSimulatedBackend_BalanceAt(t *testing.T) {
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
expectedBal := big.NewInt(10000000000)
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ environment:
install:
- git submodule update --init
- rmdir C:\go /s /q
- appveyor DownloadFile https://dl.google.com/go/go1.14.2.windows-%GETH_ARCH%.zip
- 7z x go1.14.2.windows-%GETH_ARCH%.zip -y -oC:\ > NUL
- appveyor DownloadFile https://dl.google.com/go/go1.15.windows-%GETH_ARCH%.zip
- 7z x go1.15.windows-%GETH_ARCH%.zip -y -oC:\ > NUL
- go version
- gcc --version

Expand Down
2 changes: 1 addition & 1 deletion build/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file contains sha256 checksums of optional build dependencies.

98de84e69726a66da7b4e58eac41b99cbe274d7e8906eeb8a5b7eb0aadee7f7c go1.14.2.src.tar.gz
69438f7ed4f532154ffaf878f3dfd83747e7a00b70b3556eddabf7aaee28ac3a go1.15.src.tar.gz

d998a84eea42f2271aca792a7b027ca5c1edfcba229e8e5a844c9ac3f336df35 golangci-lint-1.27.0-linux-armv7.tar.gz
bf781f05b0d393b4bf0a327d9e62926949a4f14d7774d950c4e009fc766ed1d4 golangci-lint.exe-1.27.0-windows-amd64.zip
Expand Down
3 changes: 2 additions & 1 deletion build/ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,14 @@ var (
// Note: zesty is unsupported because it was officially deprecated on Launchpad.
// Note: artful is unsupported because it was officially deprecated on Launchpad.
// Note: cosmic is unsupported because it was officially deprecated on Launchpad.
// Note: disco is unsupported because it was officially deprecated on Launchpad.
debDistroGoBoots = map[string]string{
"trusty": "golang-1.11",
"xenial": "golang-go",
"bionic": "golang-go",
"disco": "golang-go",
"eoan": "golang-go",
"focal": "golang-go",
"groovy": "golang-go",
}

debGoBootPaths = map[string]string{
Expand Down
16 changes: 8 additions & 8 deletions cmd/ancient-store-mem/lib/mem.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ func (f *MemFreezerRemoteServerAPI) Reset() {
}

func (f *MemFreezerRemoteServerAPI) HasAncient(kind string, number uint64) (bool, error) {
fmt.Println("mock server called", "method=HasAncient")
// fmt.Println("mock server called", "method=HasAncient")
f.mu.Lock()
defer f.mu.Unlock()
_, ok := f.store[f.storeKey(kind, number)]
return ok, nil
}

func (f *MemFreezerRemoteServerAPI) Ancient(kind string, number uint64) ([]byte, error) {
fmt.Println("mock server called", "method=Ancient")
// fmt.Println("mock server called", "method=Ancient")
f.mu.Lock()
defer f.mu.Unlock()
v, ok := f.store[f.storeKey(kind, number)]
Expand All @@ -79,12 +79,12 @@ func (f *MemFreezerRemoteServerAPI) Ancient(kind string, number uint64) ([]byte,
}

func (f *MemFreezerRemoteServerAPI) Ancients() (uint64, error) {
fmt.Println("mock server called", "method=Ancients")
// fmt.Println("mock server called", "method=Ancients")
return f.count, nil
}

func (f *MemFreezerRemoteServerAPI) AncientSize(kind string) (uint64, error) {
fmt.Println("mock server called", "method=AncientSize")
// fmt.Println("mock server called", "method=AncientSize")
sum := uint64(0)
for k, v := range f.store {
if strings.HasPrefix(k, kind) {
Expand All @@ -95,7 +95,7 @@ func (f *MemFreezerRemoteServerAPI) AncientSize(kind string) (uint64, error) {
}

func (f *MemFreezerRemoteServerAPI) AppendAncient(number uint64, hash, header, body, receipt, td []byte) error {
fmt.Println("mock server called", "method=AppendAncient", "number=", number, "header", fmt.Sprintf("%x", header))
// fmt.Println("mock server called", "method=AppendAncient", "number=", number, "header", fmt.Sprintf("%x", header))
fieldNames := []string{
freezerRemoteHashTable,
freezerRemoteHeaderTable,
Expand All @@ -118,7 +118,7 @@ func (f *MemFreezerRemoteServerAPI) AppendAncient(number uint64, hash, header, b
}

func (f *MemFreezerRemoteServerAPI) TruncateAncients(n uint64) error {
fmt.Println("mock server called", "method=TruncateAncients")
// fmt.Println("mock server called", "method=TruncateAncients")
f.count = n
f.mu.Lock()
defer f.mu.Unlock()
Expand All @@ -136,11 +136,11 @@ func (f *MemFreezerRemoteServerAPI) TruncateAncients(n uint64) error {
}

func (f *MemFreezerRemoteServerAPI) Sync() error {
fmt.Println("mock server called", "method=Sync")
// fmt.Println("mock server called", "method=Sync")
return nil
}

func (f *MemFreezerRemoteServerAPI) Close() error {
fmt.Println("mock server called", "method=Close")
// fmt.Println("mock server called", "method=Close")
return nil
}
18 changes: 10 additions & 8 deletions cmd/evm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Command line params that has to be supported are
--trace Output full trace logs to files <txhash>.jsonl
--trace.nomemory Disable full memory dump in traces
--trace.nostack Disable stack output in traces
--trace.noreturndata Disable return data output in traces
--output.basedir value Specifies where output files are placed. Will be created if it does not exist. (default: ".")
--output.alloc alloc Determines where to put the alloc of the post-state.
`stdout` - into the stdout output
`stderr` - into the stderr output
Expand Down Expand Up @@ -232,13 +234,13 @@ Example where blockhashes are provided:
./evm t8n --input.alloc=./testdata/3/alloc.json --input.txs=./testdata/3/txs.json --input.env=./testdata/3/env.json --trace
```
```
cat trace-0.jsonl | grep BLOCKHASH -C2
cat trace-0-0x72fadbef39cd251a437eea619cfeda752271a5faaaa2147df012e112159ffb81.jsonl | grep BLOCKHASH -C2
```
```
{"pc":0,"op":96,"gas":"0x5f58ef8","gasCost":"0x3","memory":"0x","memSize":0,"stack":[],"returnStack":[],"depth":1,"refund":0,"opName":"PUSH1","error":""}
{"pc":2,"op":64,"gas":"0x5f58ef5","gasCost":"0x14","memory":"0x","memSize":0,"stack":["0x1"],"returnStack":[],"depth":1,"refund":0,"opName":"BLOCKHASH","error":""}
{"pc":3,"op":0,"gas":"0x5f58ee1","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0xdac58aa524e50956d0c0bae7f3f8bb9d35381365d07804dd5b48a5a297c06af4"],"returnStack":[],"depth":1,"refund":0,"opName":"STOP","error":""}
{"output":"","gasUsed":"0x17","time":155861}
{"pc":0,"op":96,"gas":"0x5f58ef8","gasCost":"0x3","memory":"0x","memSize":0,"stack":[],"returnStack":[],"returnData":null,"depth":1,"refund":0,"opName":"PUSH1","error":""}
{"pc":2,"op":64,"gas":"0x5f58ef5","gasCost":"0x14","memory":"0x","memSize":0,"stack":["0x1"],"returnStack":[],"returnData":null,"depth":1,"refund":0,"opName":"BLOCKHASH","error":""}
{"pc":3,"op":0,"gas":"0x5f58ee1","gasCost":"0x0","memory":"0x","memSize":0,"stack":["0xdac58aa524e50956d0c0bae7f3f8bb9d35381365d07804dd5b48a5a297c06af4"],"returnStack":[],"returnData":null,"depth":1,"refund":0,"opName":"STOP","error":""}
{"output":"","gasUsed":"0x17","time":112885}
```

In this example, the caller has not provided the required blockhash:
Expand All @@ -254,9 +256,9 @@ Error code: 4
Another thing that can be done, is to chain invocations:
```
./evm t8n --input.alloc=./testdata/1/alloc.json --input.txs=./testdata/1/txs.json --input.env=./testdata/1/env.json --output.alloc=stdout | ./evm t8n --input.alloc=stdin --input.env=./testdata/1/env.json --input.txs=./testdata/1/txs.json
INFO [06-29|11:52:04.934] rejected tx index=1 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"
INFO [06-29|11:52:04.936] rejected tx index=0 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"
INFO [06-29|11:52:04.936] rejected tx index=1 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"
INFO [08-03|15:25:15.168] rejected tx index=1 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"
INFO [08-03|15:25:15.169] rejected tx index=0 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"
INFO [08-03|15:25:15.169] rejected tx index=1 hash="0557ba…18d673" from=0x8A8eAFb1cf62BfBeb1741769DAE1a9dd47996192 error="nonce too low"

```
What happened here, is that we first applied two identical transactions, so the second one was rejected.
Expand Down
9 changes: 5 additions & 4 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/ethereum/go-ethereum/params/types/ctypes"
"github.com/ethereum/go-ethereum/params/types/genesisT"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/trie"
"golang.org/x/crypto/sha3"
)

Expand Down Expand Up @@ -82,7 +83,7 @@ type stEnvMarshaling struct {
// Apply applies a set of transactions to a pre-state
func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig ctypes.ChainConfigurator,
txs types.Transactions, miningReward int64,
getTracerFn func(txIndex int) (tracer vm.Tracer, err error)) (*state.StateDB, *ExecutionResult, error) {
getTracerFn func(txIndex int, txHash common.Hash) (tracer vm.Tracer, err error)) (*state.StateDB, *ExecutionResult, error) {

// Capture errors for BLOCKHASH operation, if we haven't been supplied the
// required blockhashes
Expand Down Expand Up @@ -137,7 +138,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig ctypes.ChainConfigura
rejectedTxs = append(rejectedTxs, i)
continue
}
tracer, err := getTracerFn(txIndex)
tracer, err := getTracerFn(txIndex, tx.Hash())
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -223,8 +224,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig ctypes.ChainConfigura
}
execRs := &ExecutionResult{
StateRoot: root,
TxRoot: types.DeriveSha(includedTxs),
ReceiptRoot: types.DeriveSha(receipts),
TxRoot: types.DeriveSha(includedTxs, new(trie.Trie)),
ReceiptRoot: types.DeriveSha(receipts, new(trie.Trie)),
Bloom: types.CreateBloom(receipts),
LogsHash: rlpHash(statedb.Logs()),
Receipts: receipts,
Expand Down
5 changes: 5 additions & 0 deletions cmd/evm/internal/t8ntool/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ var (
Name: "trace.noreturndata",
Usage: "Disable return data output in traces",
}
OutputBasedir = cli.StringFlag{
Name: "output.basedir",
Usage: "Specifies where output files are placed. Will be created if it does not exist.",
Value: "",
}
OutputAllocFlag = cli.StringFlag{
Name: "output.alloc",
Usage: "Determines where to put the `alloc` of the post-state.\n" +
Expand Down
Loading