From f32578628a7856713e13bcef46ab2cd3fd132131 Mon Sep 17 00:00:00 2001 From: Silas Davis Date: Thu, 25 Mar 2021 18:31:43 +0100 Subject: [PATCH] Fix LoadDump not setting tx index Signed-off-by: Silas Davis --- CHANGELOG.md | 7 +++++++ NOTES.md | 7 ++----- bcm/blockchain.go | 5 ++++- cmd/burrow/commands/restore.go | 6 +++--- core/kernel.go | 8 ++++---- project/history.go | 5 +++++ 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d066286a..afda61cf8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,10 @@ # [Hyperledger Burrow](https://github.com/hyperledger/burrow) Changelog +## [0.31.3] - 2020-03-25 +### Fixed +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages + + ## [0.31.2] - 2020-03-24 ### Fixed - [Dump] Stop TxStack EventStream consumer from rejecting events from dump/restored chain because they lack tx Envelopes (as they are intended to to keep dump format minimal) @@ -726,6 +732,7 @@ This release marks the start of Eris-DB as the full permissioned blockchain node - [Blockchain] Fix getBlocks to respect block height cap. +[0.31.3]: https://github.com/hyperledger/burrow/compare/v0.31.2...v0.31.3 [0.31.2]: https://github.com/hyperledger/burrow/compare/v0.31.1...v0.31.2 [0.31.1]: https://github.com/hyperledger/burrow/compare/v0.31.0...v0.31.1 [0.31.0]: https://github.com/hyperledger/burrow/compare/v0.30.5...v0.31.0 diff --git a/NOTES.md b/NOTES.md index cfa942dc5..fcdbbffe9 100644 --- a/NOTES.md +++ b/NOTES.md @@ -1,7 +1,4 @@ ### Fixed -- [Dump] Stop TxStack EventStream consumer from rejecting events from dump/restored chain because they lack tx Envelopes (as they are intended to to keep dump format minimal) -- [Genesis] Fix hash instability introduced by accidentally removing omitempty from AppHash in genesis - -### Added -- [Vent] Implement throttling on Ethereum Vent consumer via --max-request-rate= flag to 'vent start' +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages diff --git a/bcm/blockchain.go b/bcm/blockchain.go index 28fde43fc..6d210cd7a 100644 --- a/bcm/blockchain.go +++ b/bcm/blockchain.go @@ -156,7 +156,10 @@ func (bc *Blockchain) save() error { if err != nil { return err } - bc.db.SetSync(stateKey, encodedState) + err = bc.db.SetSync(stateKey, encodedState) + if err != nil { + return err + } } return nil } diff --git a/cmd/burrow/commands/restore.go b/cmd/burrow/commands/restore.go index ee2db63e5..728f1d7f0 100644 --- a/cmd/burrow/commands/restore.go +++ b/cmd/burrow/commands/restore.go @@ -27,15 +27,15 @@ func Restore(output Output) func(cmd *cli.Cmd) { kern, err := core.NewKernel(conf.BurrowDir) if err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not create Burrow kernel: %w", err) } if err = kern.LoadLoggerFromConfig(conf.Logging); err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not load logger: %w", err) } if err = kern.LoadDump(conf.GenesisDoc, *filename, *silentOpt); err != nil { - output.Fatalf("could not create Burrow kernel: %v", err) + output.Fatalf("could not load dump: %v", err) } kern.ShutdownAndExit() diff --git a/core/kernel.go b/core/kernel.go index fd9414637..7b0d15476 100644 --- a/core/kernel.go +++ b/core/kernel.go @@ -191,21 +191,21 @@ func (kern *Kernel) LoadDump(genesisDoc *genesis.GenesisDoc, restoreFile string, reader, err := dump.NewFileReader(restoreFile) if err != nil { - return err + return fmt.Errorf("could not create dump file reader: %w", err) } err = dump.Load(reader, kern.State) if err != nil { - return err + return fmt.Errorf("could not load dump state: %w", err) } if !bytes.Equal(kern.State.Hash(), kern.Blockchain.GenesisDoc().AppHash) { - return fmt.Errorf("restore produced a different apphash expect 0x%x got 0x%x", + return fmt.Errorf("restore produced a different apphash, expected %X by actual was %X", kern.Blockchain.GenesisDoc().AppHash, kern.State.Hash()) } err = kern.Blockchain.CommitWithAppHash(kern.State.Hash()) if err != nil { - return fmt.Errorf("unable to commit %v", err) + return fmt.Errorf("unable to commit %w", err) } kern.Logger.InfoMsg("State restore successful", diff --git a/project/history.go b/project/history.go index 1193fcbc5..6186a0d2a 100644 --- a/project/history.go +++ b/project/history.go @@ -48,6 +48,11 @@ func FullVersion() string { // release tagging script: ./scripts/tag_release.sh var History relic.ImmutableHistory = relic.NewHistory("Hyperledger Burrow", "https://github.com/hyperledger/burrow"). MustDeclareReleases( + "0.31.3 - 2020-03-25", + `### Fixed +- [Dump] Make load from dump set tx index so BlockAccumulator continuity conditions are met +- [Dump] Improve error messages +`, "0.31.2 - 2020-03-24", `### Fixed - [Dump] Stop TxStack EventStream consumer from rejecting events from dump/restored chain because they lack tx Envelopes (as they are intended to to keep dump format minimal)