Compare commits

...

5 Commits

Author SHA1 Message Date
i-norden
1735a6f308 add index to event.emitter_addr 2024-03-28 02:10:00 +00:00
Fridrik Asmundsson
75c7f16765 Add block param to EthEstimateGas 2024-03-28 02:10:00 +00:00
i-norden
2e372edde4 add index to event.emitter_addr 2024-03-28 02:09:59 +00:00
i-norden
ff21559244 add index to event_entry.key 2024-03-28 02:09:59 +00:00
Ian Norden
0a29aa0b6f fix: api: exclude reverted events in eth_getLogs results (#11318)
* exclude reverted events from results returned by eth_getLogs

* unit test

* update CHANGELOG.md
2024-03-28 02:09:59 +00:00
2 changed files with 22 additions and 3 deletions

View File

@ -411,8 +411,6 @@ This patch release allows for up to 10k messages per block. Additionally, it int
## Improvements
- fix: exchange: allow up to 10k messages per block ([filecoin-project/lotus#11506](https://github.com/filecoin-project/lotus/pull/11506))
>>>>>>> releases
# v 1.25.0 / 2023-11-22
This is a highly recommended feature release of Lotus. This optional release supports the Filecoin network version 21 upgrade, codenamed Watermelon 🍉, in addition to the numerous improvements and enhancements for node operators, ETH RPC-providers and storage providers.
@ -500,6 +498,7 @@ Lotus-workers can now be built to leverage the SupraSeal C2 sealing optimization
- fix: lotus-provider: lotus-provider msg sending ([filecoin-project/lotus#11480](https://github.com/filecoin-project/lotus/pull/11480))
- fix: lotus-provider: Fix winning PoSt ([filecoin-project/lotus#11483](https://github.com/filecoin-project/lotus/pull/11483))
- chore: fix: sql Scan cannot write to an object ([filecoin-project/lotus#11487](https://github.com/filecoin-project/lotus/pull/11487))
- fix: Exclude reverted events in `eth_getLogs` results [filecoin-project/lotus#11318](https://github.com/filecoin-project/lotus/pull/11318)
## Dependencies
- deps: update go-libp2p to v0.28.1 ([filecoin-project/lotus#10998](https://github.com/filecoin-project/lotus/pull/10998))

View File

@ -46,6 +46,7 @@ var ddls = []string{
)`,
`CREATE INDEX IF NOT EXISTS height_tipset_key ON event (height,tipset_key)`,
`CREATE INDEX IF NOT EXISTS event_emitter_addr ON event (emitter_addr)`,
`CREATE TABLE IF NOT EXISTS event_entry (
event_id INTEGER,
@ -56,6 +57,8 @@ var ddls = []string{
value BLOB NOT NULL
)`,
`CREATE INDEX IF NOT EXISTS event_entry_key_index ON event_entry (key)`,
// metadata containing version of schema
`CREATE TABLE IF NOT EXISTS _meta (
version UINT64 NOT NULL UNIQUE
@ -63,6 +66,7 @@ var ddls = []string{
`INSERT OR IGNORE INTO _meta (version) VALUES (1)`,
`INSERT OR IGNORE INTO _meta (version) VALUES (2)`,
`INSERT OR IGNORE INTO _meta (version) VALUES (3)`,
}
var (
@ -70,7 +74,7 @@ var (
)
const (
schemaVersion = 2
schemaVersion = 3
eventExists = `SELECT MAX(id) FROM event WHERE height=? AND tipset_key=? AND tipset_key_cid=? AND emitter_addr=? AND event_index=? AND message_cid=? AND message_index=?`
insertEvent = `INSERT OR IGNORE INTO event(height, tipset_key, tipset_key_cid, emitter_addr, event_index, message_cid, message_index, reverted) VALUES(?, ?, ?, ?, ?, ?, ?, ?)`
@ -321,6 +325,22 @@ func NewEventIndex(ctx context.Context, path string, chainStore *store.ChainStor
version = 2
}
if version == 2 {
log.Infof("upgrading event index from version 2 to version 3")
// to upgrade to version 3 we only need to create an index on the event_entry.key column
// and on the event.emitter_addr column
// which means we can just reapply the schema (it will not have any effect on existing data)
for _, ddl := range ddls {
if _, err := db.Exec(ddl); err != nil {
_ = db.Close()
return nil, xerrors.Errorf("could not upgrade index to version 3, exec ddl %q: %w", ddl, err)
}
}
version = 3
}
if version != schemaVersion {
_ = db.Close()
return nil, xerrors.Errorf("invalid database version: got %d, expected %d", version, schemaVersion)