Skip to content

Commit

Permalink
Revert "IBC fix (#204)"
Browse files Browse the repository at this point in the history
This reverts commit 008b083.
  • Loading branch information
udpatil committed Mar 29, 2023
1 parent 97b872c commit 9e8c0fa
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 130 deletions.
66 changes: 3 additions & 63 deletions baseapp/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -914,27 +914,7 @@ func splitPath(requestPath string) (path []string) {
func (app *BaseApp) PrepareProposal(ctx context.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) {
defer telemetry.MeasureSince(time.Now(), "abci", "prepare_proposal")

header := tmproto.Header{
ChainID: app.ChainID,
Height: req.Height,
Time: req.Time,
ProposerAddress: req.ProposerAddress,
AppHash: req.AppHash,
NextValidatorsHash: req.NextValidatorsHash,
DataHash: req.DataHash,
ConsensusHash: req.ConsensusHash,
EvidenceHash: req.EvidenceHash,
ValidatorsHash: req.ValidatorsHash,
LastCommitHash: req.LastCommitHash,
LastResultsHash: req.LastResultsHash,
LastBlockId: tmproto.BlockID{
Hash: req.LastBlockHash,
PartSetHeader: tmproto.PartSetHeader{
Total: uint32(req.LastBlockPartSetTotal),
Hash: req.LastBlockPartSetHash,
},
},
}
header := tmproto.Header{ChainID: app.ChainID, Height: req.Height, Time: req.Time, ProposerAddress: req.ProposerAddress}
if app.prepareProposalState == nil {
app.setPrepareProposalState(header)
} else {
Expand Down Expand Up @@ -962,27 +942,7 @@ func (app *BaseApp) PrepareProposal(ctx context.Context, req *abci.RequestPrepar
func (app *BaseApp) ProcessProposal(ctx context.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) {
defer telemetry.MeasureSince(time.Now(), "abci", "process_proposal")

header := tmproto.Header{
ChainID: app.ChainID,
Height: req.Height,
Time: req.Time,
ProposerAddress: req.ProposerAddress,
AppHash: req.AppHash,
NextValidatorsHash: req.NextValidatorsHash,
DataHash: req.DataHash,
ConsensusHash: req.ConsensusHash,
EvidenceHash: req.EvidenceHash,
ValidatorsHash: req.ValidatorsHash,
LastCommitHash: req.LastCommitHash,
LastResultsHash: req.LastResultsHash,
LastBlockId: tmproto.BlockID{
Hash: req.LastBlockHash,
PartSetHeader: tmproto.PartSetHeader{
Total: uint32(req.LastBlockPartSetTotal),
Hash: req.LastBlockPartSetHash,
},
},
}
header := tmproto.Header{ChainID: app.ChainID, Height: req.Height, Time: req.Time, ProposerAddress: req.ProposerAddress}
if app.processProposalState == nil {
app.setProcessProposalState(header)
} else {
Expand Down Expand Up @@ -1029,27 +989,7 @@ func (app *BaseApp) FinalizeBlock(ctx context.Context, req *abci.RequestFinalize
// Initialize the DeliverTx state. If this is the first block, it should
// already be initialized in InitChain. Otherwise app.deliverState will be
// nil, since it is reset on Commit.
header := tmproto.Header{
ChainID: app.ChainID,
Height: req.Height,
Time: req.Time,
ProposerAddress: req.ProposerAddress,
AppHash: req.AppHash,
NextValidatorsHash: req.NextValidatorsHash,
DataHash: req.DataHash,
ConsensusHash: req.ConsensusHash,
EvidenceHash: req.EvidenceHash,
ValidatorsHash: req.ValidatorsHash,
LastCommitHash: req.LastCommitHash,
LastResultsHash: req.LastResultsHash,
LastBlockId: tmproto.BlockID{
Hash: req.LastBlockHash,
PartSetHeader: tmproto.PartSetHeader{
Total: uint32(req.LastBlockPartSetTotal),
Hash: req.LastBlockPartSetHash,
},
},
}
header := tmproto.Header{ChainID: app.ChainID, Height: req.Height, Time: req.Time, ProposerAddress: req.ProposerAddress}
if app.deliverState == nil {
app.setDeliverState(header)
} else {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ replace (
github.com/gin-gonic/gin => github.com/gin-gonic/gin v1.7.0
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.181
github.com/tendermint/tendermint => github.com/sei-protocol/sei-tendermint v0.1.171

// latest grpc doesn't work with with our modified proto compiler, so we need to enforce
// the following version across all dependencies.
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY=
github.com/sei-protocol/sei-iavl v0.1.2 h1:jEYkZv83DbTRapJtkT5gBFa2uEBwD4udw8AiYx0gcsI=
github.com/sei-protocol/sei-iavl v0.1.2/go.mod h1:7PfkEVT5dcoQE+s/9KWdoXJ8VVVP1QpYYPLdxlkSXFk=
github.com/sei-protocol/sei-tendermint v0.1.181 h1:ycC21MKAorOGFhdzN5HjZlA0qtIAX4iMlXTSErTLqtM=
github.com/sei-protocol/sei-tendermint v0.1.181/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
github.com/sei-protocol/sei-tendermint v0.1.171 h1:G3ZRnQgiLQ06/3iKrj5UicpHfRWJWruaJFxVYHFOcjA=
github.com/sei-protocol/sei-tendermint v0.1.171/go.mod h1:+BtDvAwTkE64BlxzpH9ZP7S6vUYT9wRXiZa/WW8/o4g=
github.com/sei-protocol/sei-tm-db v0.0.5 h1:3WONKdSXEqdZZeLuWYfK5hP37TJpfaUa13vAyAlvaQY=
github.com/sei-protocol/sei-tm-db v0.0.5/go.mod h1:Cpa6rGyczgthq7/0pI31jys2Fw0Nfrc+/jKdP1prVqY=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
Expand Down
16 changes: 8 additions & 8 deletions store/cachekv/mergeiterator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ func TestEmitEventMangerInIterator(t *testing.T) {
iter.Value()

// assert the resource access is still emitted correctly when the cache store is unavailable
require.Equal(t, "access_type", string(eventManager.Events()[0].Attributes[0].Key))
require.Equal(t, "read", string(eventManager.Events()[0].Attributes[0].Value))
require.Equal(t, "store_key", string(eventManager.Events()[0].Attributes[1].Key))
require.Equal(t, "CacheKvTest", string(eventManager.Events()[0].Attributes[1].Value))
require.Equal(t, "access_type", eventManager.Events()[0].Attributes[0].Key)
require.Equal(t, "read", eventManager.Events()[0].Attributes[0].Value)
require.Equal(t, "store_key", eventManager.Events()[0].Attributes[1].Key)
require.Equal(t, "CacheKvTest", eventManager.Events()[0].Attributes[1].Value)

// assert event emission when cache is available
cache = kvstore.Iterator(keys[1], keys[2])
Expand All @@ -49,8 +49,8 @@ func TestEmitEventMangerInIterator(t *testing.T) {
iter.Value()

// assert the resource access is still emitted correctly when the cache store is available
require.Equal(t, "access_type", string(eventManager.Events()[0].Attributes[0].Key))
require.Equal(t, "read", string(eventManager.Events()[0].Attributes[0].Value))
require.Equal(t, "store_key", string(eventManager.Events()[0].Attributes[1].Key))
require.Equal(t, "CacheKvTest", string(eventManager.Events()[0].Attributes[1].Value))
require.Equal(t, "access_type", eventManager.Events()[0].Attributes[0].Key)
require.Equal(t, "read", eventManager.Events()[0].Attributes[0].Value)
require.Equal(t, "store_key", eventManager.Events()[0].Attributes[1].Key)
require.Equal(t, "CacheKvTest", eventManager.Events()[0].Attributes[1].Value)
}
12 changes: 6 additions & 6 deletions types/accesscontrol/comparator.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ func BuildComparatorFromEvents(events []abci.Event, storeKeyToResourceTypePrefix
accessType := AccessType_UNKNOWN
storeKey := ""
for _, attribute := range attributes {
if string(attribute.Key) == "key" {
identifier = string(attribute.Value)
if attribute.Key == "key" {
identifier = attribute.Value
}
if string(attribute.Key) == "access_type" {
accessType = AccessTypeStringToEnum(string(attribute.Value))
if attribute.Key == "access_type" {
accessType = AccessTypeStringToEnum(attribute.Value)
}
if string(attribute.Key) == "store_key" {
storeKey = string(attribute.Value)
if attribute.Key == "store_key" {
storeKey = attribute.Value
}
}

Expand Down
32 changes: 16 additions & 16 deletions types/accesscontrol/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("a/b/c/d/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: "key", Value: "a/b/c/d/e"},
{Key: "access_type", Value: "write"},
},
},
},
Expand All @@ -114,9 +114,9 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("a/b/c/d/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: []byte("store_key"), Value: []byte("storex")},
{Key: "key", Value: "a/b/c/d/e"},
{Key: "access_type", Value: "write"},
{Key: "store_key", Value: "storex"},
},
},
},
Expand Down Expand Up @@ -145,8 +145,8 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("abc/defg/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: "key", Value: "abc/defg/e"},
{Key: "access_type", Value: "write"},
},
},
},
Expand All @@ -163,9 +163,9 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("abc/defg/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: []byte("store_key"), Value: []byte("ParentNode")},
{Key: "key", Value: "abc/defg/e"},
{Key: "access_type", Value: "write"},
{Key: "store_key", Value: "ParentNode"},
},
},
},
Expand All @@ -182,9 +182,9 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("abc/defg/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: []byte("store_key"), Value: []byte("ParentNode")},
{Key: "key", Value: "abc/defg/e"},
{Key: "access_type", Value: "write"},
{Key: "store_key", Value: "ParentNode"},
},
},
},
Expand All @@ -201,9 +201,9 @@ func TestValidateAccessOperations(t *testing.T) {
{
Type: "resource_access",
Attributes: []abci.EventAttribute{
{Key: []byte("key"), Value: []byte("abc/defg/e")},
{Key: []byte("access_type"), Value: []byte("write")},
{Key: []byte("store_key"), Value: []byte("ParentNode")},
{Key: "key", Value: "abc/defg/e"},
{Key: "access_type", Value: "write"},
{Key: "store_key", Value: "ParentNode"},
},
},
},
Expand Down
6 changes: 3 additions & 3 deletions types/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ func TypedEventToEvent(tev proto.Message) (Event, error) {
for _, k := range keys {
v := attrMap[k]
attrs = append(attrs, abci.EventAttribute{
Key: []byte(k),
Value: v,
Key: k,
Value: string(v),
})
}

Expand Down Expand Up @@ -242,7 +242,7 @@ func (a Attribute) String() string {

// ToKVPair converts an Attribute object into a Tendermint key/value pair.
func (a Attribute) ToKVPair() abci.EventAttribute {
return abci.EventAttribute{Key: []byte(a.Key), Value: []byte(a.Value)}
return abci.EventAttribute{Key: a.Key, Value: a.Value}
}

// AppendAttributes adds one or more attributes to an Event.
Expand Down
32 changes: 16 additions & 16 deletions types/events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() {
{
Type: "message",
Attributes: []abci.EventAttribute{
{Key: []byte("sender"), Value: []byte("foo")},
{Key: []byte("recipient"), Value: []byte("bar")},
{Key: "sender", Value: "foo"},
{Key: "recipient", Value: "bar"},
},
},
{
Type: "staking",
Attributes: []abci.EventAttribute{
{Key: []byte("deposit"), Value: []byte("5")},
{Key: []byte("unbond"), Value: []byte("10")},
{Key: "deposit", Value: "5"},
{Key: "unbond", Value: "10"},
},
},
}
Expand All @@ -163,15 +163,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() {
{
Type: "message",
Attributes: []abci.EventAttribute{
{Key: []byte("sender"), Value: []byte("foo"), Index: true},
{Key: []byte("recipient"), Value: []byte("bar"), Index: true},
{Key: "sender", Value: "foo", Index: true},
{Key: "recipient", Value: "bar", Index: true},
},
},
{
Type: "staking",
Attributes: []abci.EventAttribute{
{Key: []byte("deposit"), Value: []byte("5"), Index: true},
{Key: []byte("unbond"), Value: []byte("10"), Index: true},
{Key: "deposit", Value: "5", Index: true},
{Key: "unbond", Value: "10", Index: true},
},
},
},
Expand All @@ -183,15 +183,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() {
{
Type: "message",
Attributes: []abci.EventAttribute{
{Key: []byte("sender"), Value: []byte("foo"), Index: true},
{Key: []byte("recipient"), Value: []byte("bar")},
{Key: "sender", Value: "foo", Index: true},
{Key: "recipient", Value: "bar"},
},
},
{
Type: "staking",
Attributes: []abci.EventAttribute{
{Key: []byte("deposit"), Value: []byte("5"), Index: true},
{Key: []byte("unbond"), Value: []byte("10")},
{Key: "deposit", Value: "5", Index: true},
{Key: "unbond", Value: "10"},
},
},
},
Expand All @@ -206,15 +206,15 @@ func (s *eventsTestSuite) TestMarkEventsToIndex() {
{
Type: "message",
Attributes: []abci.EventAttribute{
{Key: []byte("sender"), Value: []byte("foo"), Index: true},
{Key: []byte("recipient"), Value: []byte("bar"), Index: true},
{Key: "sender", Value: "foo", Index: true},
{Key: "recipient", Value: "bar", Index: true},
},
},
{
Type: "staking",
Attributes: []abci.EventAttribute{
{Key: []byte("deposit"), Value: []byte("5"), Index: true},
{Key: []byte("unbond"), Value: []byte("10"), Index: true},
{Key: "deposit", Value: "5", Index: true},
{Key: "unbond", Value: "10", Index: true},
},
},
},
Expand Down
8 changes: 4 additions & 4 deletions types/result_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() {
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: []byte("action"),
Value: []byte("foo"),
Key: "action",
Value: "foo",
Index: true,
},
},
Expand Down Expand Up @@ -201,8 +201,8 @@ func (s *resultTestSuite) TestResponseFormatBroadcastTxCommit() {
Type: "message",
Attributes: []abci.EventAttribute{
{
Key: []byte("action"),
Value: []byte("foo"),
Key: "action",
Value: "foo",
Index: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion x/authz/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (k Keeper) DispatchActions(ctx sdk.Context, grantee sdk.AccAddress, msgs []
sdkEvents := make([]sdk.Event, 0, len(events))
for _, event := range events {
e := event
e.Attributes = append(e.Attributes, abci.EventAttribute{Key: []byte("authz_msg_index"), Value: []byte(strconv.Itoa(i))})
e.Attributes = append(e.Attributes, abci.EventAttribute{Key: "authz_msg_index", Value: strconv.Itoa(i)})

sdkEvents = append(sdkEvents, sdk.Event(e))
}
Expand Down
Loading

0 comments on commit 9e8c0fa

Please sign in to comment.