From aeaea34544fd280c4c9606f8118c903054a0d142 Mon Sep 17 00:00:00 2001 From: hacheigriega Date: Thu, 5 Sep 2024 12:43:28 -0400 Subject: [PATCH] feat: construct data result and validator trees with sorted leaves --- app/app.go | 3 + proto/sedachain/batching/v1/batching.proto | 8 +- x/batching/keeper/abci.go | 82 +++++++++++++---- x/batching/keeper/keeper.go | 15 ++- x/batching/keeper/params.go | 2 +- x/batching/types/batching.pb.go | 101 ++++++++++----------- x/batching/types/expected_keepers.go | 4 + x/batching/types/params.go | 2 +- x/data-proxy/types/query.pb.go | 1 - x/data-proxy/types/tx.pb.go | 1 - x/wasm-storage/keeper/keeper.go | 10 +- 11 files changed, 148 insertions(+), 81 deletions(-) diff --git a/app/app.go b/app/app.go index 8d014dc2..f4e53764 100644 --- a/app/app.go +++ b/app/app.go @@ -658,6 +658,9 @@ func NewApp( runtime.NewKVStoreService(keys[batchingtypes.StoreKey]), authtypes.NewModuleAddress(batchingtypes.ModuleName).String(), app.StakingKeeper, + app.WasmStorageKeeper, + contractKeeper, + app.WasmKeeper, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), ) diff --git a/proto/sedachain/batching/v1/batching.proto b/proto/sedachain/batching/v1/batching.proto index 41f35bee..793555f3 100644 --- a/proto/sedachain/batching/v1/batching.proto +++ b/proto/sedachain/batching/v1/batching.proto @@ -15,9 +15,9 @@ message Batch { uint64 batch_number = 1; // block_height is the height at which the batch was created. int64 block_height = 2; - // data_result_root is the root of the data result merkle tree. + // data_result_root is the hex-encoded root of the data result merkle tree. string data_result_root = 3; - // validator_root is the root of the validator merkle tree. + // validator_root is the hex-encoded root of the validator merkle tree. string validator_root = 4; // votes is the canonical set of votes on the batch from validators. repeated Vote votes = 5; @@ -54,7 +54,7 @@ message Signature { message Params { option (gogoproto.equal) = true; - // validator_set_trim_percentage is the percentage of the validator + // validator_set_trim_percent is the percentage of the validator // set to store in the validator merkle tree in the batch. - uint32 validator_set_trim_percentage = 1; + uint32 validator_set_trim_percent = 1; } diff --git a/x/batching/keeper/abci.go b/x/batching/keeper/abci.go index 0a50229c..12e1ef38 100644 --- a/x/batching/keeper/abci.go +++ b/x/batching/keeper/abci.go @@ -1,14 +1,19 @@ package keeper import ( + "bytes" "encoding/binary" "encoding/hex" + "encoding/json" "fmt" + "sort" + + "github.com/cometbft/cometbft/crypto/merkle" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/sedaprotocol/seda-chain/x/batching/types" - "github.com/cometbft/cometbft/crypto/merkle" + "github.com/sedaprotocol/seda-chain/x/batching/types" + tallytypes "github.com/sedaprotocol/seda-chain/x/tally/types" ) func (k Keeper) EndBlock(ctx sdk.Context) (err error) { @@ -36,6 +41,10 @@ func (k Keeper) EndBlock(ctx sdk.Context) (err error) { if err != nil { panic(err) } + err = k.IncrementCurrentBatchNum(ctx) + if err != nil { + panic(err) + } return nil } @@ -47,39 +56,74 @@ func (k Keeper) ConstructBatch(ctx sdk.Context) (types.Batch, error) { } // Construct data result tree. - // Fetch batch-ready data requests. + coreContract, err := k.wasmStorageKeeper.GetCoreContractAddr(ctx) + if err != nil { + return types.Batch{}, err + } // TODO: Deal with offset and limits. (#313) - // queryRes, err := k.wasmViewKeeper.QuerySmart(ctx, coreContract, []byte(`{"get_data_requests_by_status":{"status": "tallied", "offset": 0, "limit": 100}}`)) - // if err != nil { - // return err - // } - // if string(queryRes) == "[]" { - // return nil - // } + queryRes, err := k.wasmViewKeeper.QuerySmart(ctx, coreContract, []byte(`{"get_data_results_by_status":{"status": "tallied", "offset": 0, "limit": 100}}`)) + if err != nil { + return types.Batch{}, err + } + if string(queryRes) == "[]" { + return types.Batch{}, err + } - // Leaves are SHA-256 hashes of JSON-serialized data result structs. + var dataResults []tallytypes.DataResult + err = json.Unmarshal(queryRes, &dataResults) + if err != nil { + return types.Batch{}, err + } + + var dataLeaves [][]byte + for _, res := range dataResults { + resHash, err := hex.DecodeString(res.ID) + if err != nil { + return types.Batch{}, err + } + dataLeaves = append(dataLeaves, resHash) + } + + sort.Slice(dataLeaves, func(i, j int) bool { + if bytes.Compare(dataLeaves[i], dataLeaves[j]) == -1 { + return true + } + return false + }) + dataRoot := merkle.HashFromByteSlices(dataLeaves) + dataRootHex := hex.EncodeToString(dataRoot) // Construct validator tree. - var leaves [][]byte + var valLeaves [][]byte err = k.stakingKeeper.IterateLastValidatorPowers(ctx, func(addr sdk.ValAddress, power int64) (stop bool) { + // TODO construct with pubkey in pubkey module instead buf := make([]byte, len(addr)+8) copy(buf[:len(addr)], addr) binary.BigEndian.PutUint64(buf[:len(addr)], uint64(power)) - leaves = append(leaves, addr) + valLeaves = append(valLeaves, addr) return false }) if err != nil { return types.Batch{}, err } - valRoot := merkle.HashFromByteSlices(leaves) // TODO "ordered" merkle tree + + // TODO subtrees based on keys + + sort.Slice(valLeaves, func(i, j int) bool { + if bytes.Compare(valLeaves[i], valLeaves[j]) == -1 { + return true + } + return false + }) + valRoot := merkle.HashFromByteSlices(valLeaves) valRootHex := hex.EncodeToString(valRoot) return types.Batch{ - BatchNumber: curBatchNum, - BlockHeight: ctx.BlockHeight(), - // DataResultRoot: , - ValidatorRoot: valRootHex, - BlockTime: ctx.BlockTime(), + BatchNumber: curBatchNum, + BlockHeight: ctx.BlockHeight(), + DataResultRoot: dataRootHex, + ValidatorRoot: valRootHex, + BlockTime: ctx.BlockTime(), }, nil } diff --git a/x/batching/keeper/keeper.go b/x/batching/keeper/keeper.go index 5e7f7024..5f155f96 100644 --- a/x/batching/keeper/keeper.go +++ b/x/batching/keeper/keeper.go @@ -4,6 +4,8 @@ import ( "context" "fmt" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "cosmossdk.io/collections" addresscodec "cosmossdk.io/core/address" storetypes "cosmossdk.io/core/store" @@ -17,6 +19,9 @@ import ( type Keeper struct { stakingKeeper types.StakingKeeper + wasmStorageKeeper types.WasmStorageKeeper + wasmKeeper wasmtypes.ContractOpsKeeper + wasmViewKeeper wasmtypes.ViewKeeper validatorAddressCodec addresscodec.Codec // authority is the address capable of executing MsgUpdateParams. @@ -34,14 +39,20 @@ func NewKeeper( storeService storetypes.KVStoreService, authority string, sk types.StakingKeeper, + wsk types.WasmStorageKeeper, + wk wasmtypes.ContractOpsKeeper, + wvk wasmtypes.ViewKeeper, validatorAddressCodec addresscodec.Codec, ) Keeper { sb := collections.NewSchemaBuilder(storeService) k := Keeper{ - authority: authority, stakingKeeper: sk, + wasmStorageKeeper: wsk, + wasmKeeper: wk, + wasmViewKeeper: wvk, validatorAddressCodec: validatorAddressCodec, + authority: authority, currentBatchNumber: collections.NewSequence(sb, types.CurrentBatchNumberKey, "current_batch_number"), batch: collections.NewMap(sb, types.BatchPrefix, "batch", collections.Uint64Key, codec.CollValue[types.Batch](cdc)), params: collections.NewItem(sb, types.ParamsKey, "params", codec.CollValue[types.Params](cdc)), @@ -59,7 +70,7 @@ func (k Keeper) SetCurrentBatchNum(ctx context.Context, batchNum uint64) error { return k.currentBatchNumber.Set(ctx, batchNum) } -func (k Keeper) IncrementCurrentBatchNum(ctx context.Context, batchNum uint64) error { +func (k Keeper) IncrementCurrentBatchNum(ctx context.Context) error { _, err := k.currentBatchNumber.Next(ctx) return err } diff --git a/x/batching/keeper/params.go b/x/batching/keeper/params.go index c9aae2bf..35f25f66 100644 --- a/x/batching/keeper/params.go +++ b/x/batching/keeper/params.go @@ -16,5 +16,5 @@ func (k Keeper) GetParams(ctx sdk.Context) (types.Params, error) { func (k Keeper) GetValSetTrimPercent(ctx sdk.Context) (uint32, error) { params, err := k.params.Get(ctx) - return params.ValidatorSetTrimPercentage, err + return params.ValidatorSetTrimPercent, err } diff --git a/x/batching/types/batching.pb.go b/x/batching/types/batching.pb.go index c4c6d574..325d62dd 100644 --- a/x/batching/types/batching.pb.go +++ b/x/batching/types/batching.pb.go @@ -36,9 +36,9 @@ type Batch struct { BatchNumber uint64 `protobuf:"varint,1,opt,name=batch_number,json=batchNumber,proto3" json:"batch_number,omitempty"` // block_height is the height at which the batch was created. BlockHeight int64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - // data_result_root is the root of the data result merkle tree. + // data_result_root is the hex-encoded root of the data result merkle tree. DataResultRoot string `protobuf:"bytes,3,opt,name=data_result_root,json=dataResultRoot,proto3" json:"data_result_root,omitempty"` - // validator_root is the root of the validator merkle tree. + // validator_root is the hex-encoded root of the validator merkle tree. ValidatorRoot string `protobuf:"bytes,4,opt,name=validator_root,json=validatorRoot,proto3" json:"validator_root,omitempty"` // votes is the canonical set of votes on the batch from validators. Votes []*Vote `protobuf:"bytes,5,rep,name=votes,proto3" json:"votes,omitempty"` @@ -260,9 +260,9 @@ func (m *Signature) GetMerkleProof() string { // Module parameters which can be changed through governance. type Params struct { - // validator_set_trim_percentage is the percentage of the validator + // validator_set_trim_percent is the percentage of the validator // set to store in the validator merkle tree in the batch. - ValidatorSetTrimPercentage uint32 `protobuf:"varint,1,opt,name=validator_set_trim_percentage,json=validatorSetTrimPercentage,proto3" json:"validator_set_trim_percentage,omitempty"` + ValidatorSetTrimPercent uint32 `protobuf:"varint,1,opt,name=validator_set_trim_percent,json=validatorSetTrimPercent,proto3" json:"validator_set_trim_percent,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -298,9 +298,9 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetValidatorSetTrimPercentage() uint32 { +func (m *Params) GetValidatorSetTrimPercent() uint32 { if m != nil { - return m.ValidatorSetTrimPercentage + return m.ValidatorSetTrimPercent } return 0 } @@ -317,43 +317,42 @@ func init() { } var fileDescriptor_5b2a028024867de2 = []byte{ - // 562 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x93, 0xc1, 0x6e, 0xd3, 0x4c, - 0x10, 0xc7, 0xb3, 0x4d, 0x1a, 0x7d, 0xde, 0x7c, 0xad, 0x90, 0x05, 0xc8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 0x08, 0xfb, 0x3c, 0xce, 0x70, 0x81, 0x55, - 0xd3, 0x7b, 0xc1, 0x3a, 0x32, 0x9f, 0x40, 0xa3, 0xad, 0x51, 0x7d, 0x18, 0xc1, 0x46, 0x30, 0x0f, - 0x20, 0xac, 0xea, 0x28, 0x27, 0x71, 0x38, 0xc3, 0x8b, 0xf5, 0xfa, 0x0c, 0xad, 0xbc, 0xc2, 0x0b, - 0x39, 0x47, 0x81, 0xd9, 0x2c, 0xc7, 0xf2, 0x87, 0xa2, 0xd7, 0xeb, 0xbd, 0x0d, 0xb4, 0x36, 0x95, - 0xd2, 0xf3, 0xde, 0xef, 0xcf, 0x23, 0x30, 0x7e, 0x0b, 0xfb, 0x53, 0xc4, 0x50, 0xc1, 0xcd, 0x33, - 0x78, 0xb0, 0x31, 0x91, 0x63, 0x11, 0x0a, 0x46, 0x8a, 0xb0, 0xc2, 0x2c, 0xc6, 0xa5, 0x40, 0x69, - 0xd3, 0xde, 0xb0, 0x85, 0x2e, 0xb0, 0xb8, 0x64, 0xa4, 0x98, 0xb6, 0x84, 0x3e, 0x72, 0xf2, 0xfa, - 0x76, 0x69, 0x83, 0xbb, 0xa5, 0x0d, 0x7e, 0x2d, 0x6d, 0x70, 0xb3, 0xb2, 0x3b, 0x77, 0x2b, 0xbb, - 0xf3, 0x7d, 0x65, 0x77, 0xde, 0x9d, 0xa6, 0x44, 0x64, 0x75, 0xe4, 0xc5, 0xb4, 0xf0, 0xa5, 0x61, - 0x6a, 0xd1, 0x31, 0xcd, 0x55, 0x70, 0xa4, 0x5f, 0xdc, 0x87, 0xcd, 0x9b, 0x13, 0x8b, 0x0a, 0xf3, - 0xa8, 0xaf, 0xa8, 0xd3, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x54, 0x08, 0xea, 0xa2, 0x96, 0x03, - 0x00, 0x00, + // 560 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff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8, 0x2a, + 0xcc, 0x30, 0x49, 0x33, 0x61, 0x6d, 0x39, 0xc0, 0xed, 0x06, 0x03, 0xc5, 0x4e, 0x14, 0x32, 0x5d, + 0x78, 0x2f, 0x41, 0x02, 0x85, 0x0c, 0xf3, 0x3a, 0x17, 0x21, 0xa3, 0x54, 0x58, 0x5d, 0x07, 0xb8, + 0x46, 0xb0, 0x2b, 0x79, 0xa0, 0x70, 0x40, 0xa9, 0x30, 0x9f, 0xc3, 0xdd, 0x19, 0xca, 0x49, 0x82, + 0x04, 0x65, 0x5a, 0xd7, 0x53, 0xba, 0x9d, 0x96, 0x2a, 0xd9, 0x21, 0xdc, 0x9e, 0x51, 0x81, 0xb9, + 0xb5, 0xed, 0x74, 0xdd, 0xc1, 0xd1, 0x13, 0xef, 0x9f, 0xce, 0x78, 0x17, 0x54, 0xe0, 0x40, 0x2b, + 0xcd, 0x37, 0x10, 0xea, 0x36, 0xa5, 0x0f, 0x56, 0xdf, 0x01, 0xee, 0xe0, 0x68, 0xe8, 0x69, 0x93, + 0xbc, 0x95, 0x49, 0xde, 0xf9, 0xca, 0xa4, 0xc9, 0x9d, 0x9b, 0x9f, 0xa3, 0xce, 0xf5, 0xaf, 0x11, + 0x08, 0x0c, 0x55, 0x27, 0x33, 0xe3, 0x6f, 0x00, 0xf6, 0xe4, 0xa1, 0xe6, 0xc9, 0x66, 0x9f, 0x28, + 0x49, 0xb4, 0x33, 0xc6, 0x64, 0xff, 0xfb, 0xd7, 0x83, 0xbd, 0xc6, 0xcb, 0x8b, 0x95, 0xe0, 0x75, + 0x92, 0x30, 0xcc, 0xf9, 0x99, 0x60, 0xa4, 0x4c, 0x37, 0x46, 0x91, 0x5c, 0xda, 0x37, 0xa3, 0x82, + 0x94, 0x69, 0x58, 0xd1, 0x0f, 0x98, 0xad, 0xec, 0xd3, 0x6c, 0x2a, 0x91, 0xf9, 0x0a, 0x42, 0x4e, + 0xd2, 0x12, 0x89, 0x9a, 0x61, 0x6e, 0x75, 0x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x90, 0x03, 0x00, 0x00, } func (this *Signature) Equal(that interface{}) bool { @@ -408,7 +407,7 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } - if this.ValidatorSetTrimPercentage != that1.ValidatorSetTrimPercentage { + if this.ValidatorSetTrimPercent != that1.ValidatorSetTrimPercent { return false } return true @@ -600,8 +599,8 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.ValidatorSetTrimPercentage != 0 { - i = encodeVarintBatching(dAtA, i, uint64(m.ValidatorSetTrimPercentage)) + if m.ValidatorSetTrimPercent != 0 { + i = encodeVarintBatching(dAtA, i, uint64(m.ValidatorSetTrimPercent)) i-- dAtA[i] = 0x8 } @@ -702,8 +701,8 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.ValidatorSetTrimPercentage != 0 { - n += 1 + sovBatching(uint64(m.ValidatorSetTrimPercentage)) + if m.ValidatorSetTrimPercent != 0 { + n += 1 + sovBatching(uint64(m.ValidatorSetTrimPercent)) } return n } @@ -1264,9 +1263,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetTrimPercentage", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorSetTrimPercent", wireType) } - m.ValidatorSetTrimPercentage = 0 + m.ValidatorSetTrimPercent = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBatching @@ -1276,7 +1275,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ValidatorSetTrimPercentage |= uint32(b&0x7F) << shift + m.ValidatorSetTrimPercent |= uint32(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/batching/types/expected_keepers.go b/x/batching/types/expected_keepers.go index 521d49b9..d92f6648 100644 --- a/x/batching/types/expected_keepers.go +++ b/x/batching/types/expected_keepers.go @@ -14,3 +14,7 @@ type StakingKeeper interface { GetValidatorUpdates(ctx context.Context) ([]abci.ValidatorUpdate, error) IterateLastValidatorPowers(ctx context.Context, handler func(operator sdk.ValAddress, power int64) (stop bool)) error } + +type WasmStorageKeeper interface { + GetCoreContractAddr(ctx context.Context) (sdk.AccAddress, error) +} diff --git a/x/batching/types/params.go b/x/batching/types/params.go index 2dc42bad..0ccac23e 100644 --- a/x/batching/types/params.go +++ b/x/batching/types/params.go @@ -7,7 +7,7 @@ const ( // DefaultParams returns default batching module parameters. func DefaultParams() Params { return Params{ - ValidatorSetTrimPercentage: DefaultValSetTrimPercent, + ValidatorSetTrimPercent: DefaultValSetTrimPercent, } } diff --git a/x/data-proxy/types/query.pb.go b/x/data-proxy/types/query.pb.go index 4bdeebbb..bf75917b 100644 --- a/x/data-proxy/types/query.pb.go +++ b/x/data-proxy/types/query.pb.go @@ -223,7 +223,6 @@ func _Query_DataProxyConfig_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -var Query_serviceDesc = _Query_serviceDesc var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "sedachain.data_proxy.v1.Query", HandlerType: (*QueryServer)(nil), diff --git a/x/data-proxy/types/tx.pb.go b/x/data-proxy/types/tx.pb.go index 357dcda8..58222a8d 100644 --- a/x/data-proxy/types/tx.pb.go +++ b/x/data-proxy/types/tx.pb.go @@ -722,7 +722,6 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } -var Msg_serviceDesc = _Msg_serviceDesc var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "sedachain.data_proxy.v1.Msg", HandlerType: (*MsgServer)(nil), diff --git a/x/wasm-storage/keeper/keeper.go b/x/wasm-storage/keeper/keeper.go index 734910c4..f66020e3 100644 --- a/x/wasm-storage/keeper/keeper.go +++ b/x/wasm-storage/keeper/keeper.go @@ -37,7 +37,15 @@ type Keeper struct { Params collections.Item[types.Params] } -func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService, authority string, ak types.AccountKeeper, bk types.BankKeeper, wk wasmtypes.ContractOpsKeeper, wvk wasmtypes.ViewKeeper) *Keeper { +func NewKeeper( + cdc codec.BinaryCodec, + storeService storetypes.KVStoreService, + authority string, + ak types.AccountKeeper, + bk types.BankKeeper, + wk wasmtypes.ContractOpsKeeper, + wvk wasmtypes.ViewKeeper, +) *Keeper { sb := collections.NewSchemaBuilder(storeService) k := Keeper{