From e4a7cb0d796ffea52cfd7ba467c1195524e53671 Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 31 Oct 2023 17:48:37 +0100 Subject: [PATCH 1/2] Fix: bit mask type --- internal/storage/block.go | 2 +- internal/storage/mock/address.go | 1 - internal/storage/mock/balance.go | 1 - internal/storage/mock/block.go | 1 - internal/storage/mock/block_stats.go | 1 - internal/storage/mock/constant.go | 1 - internal/storage/mock/denom_metadata.go | 1 - internal/storage/mock/event.go | 1 - internal/storage/mock/generic.go | 1 - internal/storage/mock/message.go | 1 - internal/storage/mock/namespace.go | 1 - internal/storage/mock/state.go | 1 - internal/storage/mock/stats.go | 1 - internal/storage/mock/tx.go | 1 - internal/storage/mock/validator.go | 1 - internal/storage/postgres/scopes.go | 2 +- internal/storage/tx.go | 2 +- internal/storage/types/msg_type_bitmask.go | 4 ++-- pkg/node/mock/api.go | 1 - 19 files changed, 5 insertions(+), 20 deletions(-) diff --git a/internal/storage/block.go b/internal/storage/block.go index fbc6954d..31941148 100644 --- a/internal/storage/block.go +++ b/internal/storage/block.go @@ -36,7 +36,7 @@ type Block struct { VersionBlock uint64 `bun:"version_block" comment:"Block version"` VersionApp uint64 `bun:"version_app" comment:"App version"` - MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(73)" comment:"Bit mask with containing messages"` + MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(74)" comment:"Bit mask with containing messages"` Hash pkgTypes.Hex `bun:"hash" comment:"Block hash"` ParentHash pkgTypes.Hex `bun:"parent_hash" comment:"Hash of parent block"` diff --git a/internal/storage/mock/address.go b/internal/storage/mock/address.go index 074a326e..7d380590 100644 --- a/internal/storage/mock/address.go +++ b/internal/storage/mock/address.go @@ -5,7 +5,6 @@ // // mockgen -source=address.go -destination=mock/address.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/balance.go b/internal/storage/mock/balance.go index eef0d935..684c1bc2 100644 --- a/internal/storage/mock/balance.go +++ b/internal/storage/mock/balance.go @@ -5,7 +5,6 @@ // // mockgen -source=balance.go -destination=mock/balance.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/block.go b/internal/storage/mock/block.go index ccc4dc4f..b3af1472 100644 --- a/internal/storage/mock/block.go +++ b/internal/storage/mock/block.go @@ -5,7 +5,6 @@ // // mockgen -source=block.go -destination=mock/block.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/block_stats.go b/internal/storage/mock/block_stats.go index 81abfe06..bbf39bbd 100644 --- a/internal/storage/mock/block_stats.go +++ b/internal/storage/mock/block_stats.go @@ -5,7 +5,6 @@ // // mockgen -source=block_stats.go -destination=mock/block_stats.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/constant.go b/internal/storage/mock/constant.go index 24bd282d..ee1891af 100644 --- a/internal/storage/mock/constant.go +++ b/internal/storage/mock/constant.go @@ -5,7 +5,6 @@ // // mockgen -source=constant.go -destination=mock/constant.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/denom_metadata.go b/internal/storage/mock/denom_metadata.go index e07c0f02..1c9c6e60 100644 --- a/internal/storage/mock/denom_metadata.go +++ b/internal/storage/mock/denom_metadata.go @@ -5,7 +5,6 @@ // // mockgen -source=denom_metadata.go -destination=mock/denom_metadata.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/event.go b/internal/storage/mock/event.go index 8c2ff172..52cdd576 100644 --- a/internal/storage/mock/event.go +++ b/internal/storage/mock/event.go @@ -5,7 +5,6 @@ // // mockgen -source=event.go -destination=mock/event.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/generic.go b/internal/storage/mock/generic.go index 16a3031a..fa9d0e6c 100644 --- a/internal/storage/mock/generic.go +++ b/internal/storage/mock/generic.go @@ -5,7 +5,6 @@ // // mockgen -source=generic.go -destination=mock/generic.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/message.go b/internal/storage/mock/message.go index f0fc3950..f4d418fb 100644 --- a/internal/storage/mock/message.go +++ b/internal/storage/mock/message.go @@ -5,7 +5,6 @@ // // mockgen -source=message.go -destination=mock/message.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/namespace.go b/internal/storage/mock/namespace.go index 2a603d89..9c31aa3f 100644 --- a/internal/storage/mock/namespace.go +++ b/internal/storage/mock/namespace.go @@ -5,7 +5,6 @@ // // mockgen -source=namespace.go -destination=mock/namespace.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/state.go b/internal/storage/mock/state.go index 21cc4d68..37c546da 100644 --- a/internal/storage/mock/state.go +++ b/internal/storage/mock/state.go @@ -5,7 +5,6 @@ // // mockgen -source=state.go -destination=mock/state.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/stats.go b/internal/storage/mock/stats.go index e2dceafd..1d17c6ae 100644 --- a/internal/storage/mock/stats.go +++ b/internal/storage/mock/stats.go @@ -5,7 +5,6 @@ // // mockgen -source=stats.go -destination=mock/stats.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/tx.go b/internal/storage/mock/tx.go index 3daa2a54..88c02e45 100644 --- a/internal/storage/mock/tx.go +++ b/internal/storage/mock/tx.go @@ -5,7 +5,6 @@ // // mockgen -source=tx.go -destination=mock/tx.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/mock/validator.go b/internal/storage/mock/validator.go index d0f17023..ceb55561 100644 --- a/internal/storage/mock/validator.go +++ b/internal/storage/mock/validator.go @@ -5,7 +5,6 @@ // // mockgen -source=validator.go -destination=mock/validator.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock diff --git a/internal/storage/postgres/scopes.go b/internal/storage/postgres/scopes.go index f0d63ac8..05c8f9aa 100644 --- a/internal/storage/postgres/scopes.go +++ b/internal/storage/postgres/scopes.go @@ -46,7 +46,7 @@ func txFilter(query *bun.SelectQuery, fltrs storage.TxFilter) *bun.SelectQuery { query = sortScope(query, "id", fltrs.Sort) if !fltrs.MessageTypes.Empty() { - query = query.Where("bit_count(message_types & ?::bit(73)) > 0", fltrs.MessageTypes) + query = query.Where("bit_count(message_types & ?::bit(74)) > 0", fltrs.MessageTypes) } if len(fltrs.Status) > 0 { diff --git a/internal/storage/tx.go b/internal/storage/tx.go index 5b024fcc..116c9be9 100644 --- a/internal/storage/tx.go +++ b/internal/storage/tx.go @@ -58,7 +58,7 @@ type Tx struct { Codespace string `bun:"codespace,type:text" comment:"Codespace" stats:"filterable"` Hash []byte `bun:"hash" comment:"Transaction hash"` Memo string `bun:"memo,type:text" comment:"Note or comment to send with the transaction"` - MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(73)" comment:"Bit mask with containing messages" stats:"filterable"` + MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(74)" comment:"Bit mask with containing messages" stats:"filterable"` Messages []Message `bun:"rel:has-many,join:id=tx_id"` Events []Event `bun:"rel:has-many"` diff --git a/internal/storage/types/msg_type_bitmask.go b/internal/storage/types/msg_type_bitmask.go index 5d329d00..1a0cd817 100644 --- a/internal/storage/types/msg_type_bitmask.go +++ b/internal/storage/types/msg_type_bitmask.go @@ -637,7 +637,7 @@ var _ driver.Valuer = (*MsgTypeBits)(nil) func (mask MsgTypeBits) Value() (driver.Value, error) { if mask.value == nil { - return fmt.Sprintf("%073b", 0), nil + return fmt.Sprintf("%074b", 0), nil } - return fmt.Sprintf("%073b", mask.value), nil + return fmt.Sprintf("%074b", mask.value), nil } diff --git a/pkg/node/mock/api.go b/pkg/node/mock/api.go index 9024b77b..da0d6c19 100644 --- a/pkg/node/mock/api.go +++ b/pkg/node/mock/api.go @@ -5,7 +5,6 @@ // // mockgen -source=api.go -destination=mock/api.go -package=mock -typed // - // Package mock is a generated GoMock package. package mock From 4f92e4dbb37d2c48c4e29f534551a961846a5df6 Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 31 Oct 2023 17:53:08 +0100 Subject: [PATCH 2/2] Fix: tests --- test/data/block.yml | 4 ++-- test/data/rollback/block.yml | 6 +++--- test/data/rollback/tx.yml | 6 +++--- test/data/tx.yml | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/test/data/block.yml b/test/data/block.yml index dd8a457a..3674e5c6 100644 --- a/test/data/block.yml +++ b/test/data/block.yml @@ -14,7 +14,7 @@ last_results_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 evidence_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 proposer_address: 0x81A24EE534DEFE1557A4C7C437E8E8FBC2F834E8 - message_types: "0000000000000000000000000000000000000000000000000000000000000000101000100" + message_types: "00000000000000000000000000000000000000000000000000000000000000000101000100" - id: 1 height: 999 hash: 0x5F7A8DDFE6136FE76B65B9066D4F816D707F28C05B3362D66084664C5B39BA98 @@ -31,4 +31,4 @@ last_results_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 evidence_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 proposer_address: 0x81A24EE534DEFE1557A4C7C437E8E8FBC2F834E8 - message_types: "0000000000000000000000000000000000000000000000000000000000000000000000000" + message_types: "00000000000000000000000000000000000000000000000000000000000000000000000000" diff --git a/test/data/rollback/block.yml b/test/data/rollback/block.yml index a13562fc..f5f4e696 100644 --- a/test/data/rollback/block.yml +++ b/test/data/rollback/block.yml @@ -14,7 +14,7 @@ last_results_hash: 0x3330C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B333 evidence_hash: 0x3330C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B333 proposer_address: 0x33324EE534DEFE1557A4C7C437E8E8FBC2F83333 - message_types: "0000000000000000000000000000000000000000000000000000000000000000001000100" + message_types: "00000000000000000000000000000000000000000000000000000000000000000001000100" - id: 2 height: 1000 @@ -32,7 +32,7 @@ last_results_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 evidence_hash: 0xE3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855 proposer_address: 0x81A24EE534DEFE1557A4C7C437E8E8FBC2F834E8 - message_types: "0000000000000000000000000000000000000000000000000000000000000000101000100" + message_types: "00000000000000000000000000000000000000000000000000000000000000000101000100" - id: 1 height: 999 @@ -50,4 +50,4 @@ last_results_hash: 0x1110C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B111 evidence_hash: 0x1110C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B111 proposer_address: 0x11124EE534DEFE1557A4C7C437E8E8FBC2F83111 - message_types: "0000000000000000000000000000000000000000000000000000000000000000000000000" + message_types: "00000000000000000000000000000000000000000000000000000000000000000000000000" diff --git a/test/data/rollback/tx.yml b/test/data/rollback/tx.yml index ff8df277..0212745e 100644 --- a/test/data/rollback/tx.yml +++ b/test/data/rollback/tx.yml @@ -12,7 +12,7 @@ status: success codespace: sdk memo: memo - message_types: "0000000000000000000000000000000000000000000000000000000000000000001000100" + message_types: "00000000000000000000000000000000000000000000000000000000000000000001000100" - id: 2 hash: 0x652452A670011D629CC116E510BA88C1CABE061336661B1F3D206D248BD55811 height: 1000 @@ -27,7 +27,7 @@ status: success codespace: memo: memo2 - message_types: "0000000000000000000000000000000000000000000000000000000000000000100000000" + message_types: "00000000000000000000000000000000000000000000000000000000000000000100000000" - id: 3 hash: 0xBA37478C3E9A804697271ACC474D484E9160899C86E551D737EEA819FCC75003 height: 999 @@ -42,4 +42,4 @@ status: success codespace: memo: - message_types: "0000000000000000000000000000000000000000000000000000000000000000000100000" \ No newline at end of file + message_types: "00000000000000000000000000000000000000000000000000000000000000000000100000" \ No newline at end of file diff --git a/test/data/tx.yml b/test/data/tx.yml index 6de84397..0a1e4eb2 100644 --- a/test/data/tx.yml +++ b/test/data/tx.yml @@ -12,7 +12,7 @@ status: success codespace: sdk memo: memo - message_types: "0000000000000000000000000000000000000000000000000000000000000000001000100" + message_types: "00000000000000000000000000000000000000000000000000000000000000000001000100" - id: 2 hash: 0x652452A670011D629CC116E510BA88C1CABE061336661B1F3D206D248BD55811 @@ -28,7 +28,7 @@ status: success codespace: memo: memo2 - message_types: "0000000000000000000000000000000000000000000000000000000000000100000000000" + message_types: "00000000000000000000000000000000000000000000000000000000000000100000000000" - id: 3 hash: 0xBA37478C3E9A804697271ACC474D484E9160899C86E551D737EEA819FCC75003 @@ -44,7 +44,7 @@ status: success codespace: memo: - message_types: "0000000000000000000000000000000000000000000000000000000000000000000100000" + message_types: "00000000000000000000000000000000000000000000000000000000000000000000100000" - id: 4 hash: @@ -60,4 +60,4 @@ status: success codespace: memo: 34499b1ac473fbb03894c883178ecc83f0d6eaf6@64.227.18.169:26656 - message_types: "0000000000000000000000000000000000000000000000000000000000000000000100000" \ No newline at end of file + message_types: "00000000000000000000000000000000000000000000000000000000000000000000100000" \ No newline at end of file