From 3e6675487df523ac0e62935cc04f1aa0f92f9d0f Mon Sep 17 00:00:00 2001 From: Daniel T <30197399+danwt@users.noreply.github.com> Date: Fri, 15 Nov 2024 12:06:37 +0000 Subject: [PATCH] fix(fork): make fraud proposal revision into block identifier (#1478) --- .../dymension/rollapp/fraud_proposal.proto | 6 +- x/rollapp/keeper/fraud_proposal.go | 7 -- x/rollapp/types/fraud_proposal.pb.go | 80 +++++++++---------- 3 files changed, 43 insertions(+), 50 deletions(-) diff --git a/proto/dymensionxyz/dymension/rollapp/fraud_proposal.proto b/proto/dymensionxyz/dymension/rollapp/fraud_proposal.proto index 49d9001e5..903b7449c 100644 --- a/proto/dymensionxyz/dymension/rollapp/fraud_proposal.proto +++ b/proto/dymensionxyz/dymension/rollapp/fraud_proposal.proto @@ -20,11 +20,11 @@ message MsgRollappFraudProposal { // RollappID is the rollapp id. string rollapp_id = 2; - // rollapp revision. used to verify the rollapp revision is the same as the one in the fraud proposal - uint64 rollapp_revision = 3; - // The height of the fraudelent block + // The height of the fraudulent block uint64 fraud_height = 4; + // Revision of fraudulent block + uint64 fraud_revision = 3; // sequencer address to punish. optional string punish_sequencer_address = 6; diff --git a/x/rollapp/keeper/fraud_proposal.go b/x/rollapp/keeper/fraud_proposal.go index 00187be7c..68ad5ae29 100644 --- a/x/rollapp/keeper/fraud_proposal.go +++ b/x/rollapp/keeper/fraud_proposal.go @@ -35,13 +35,6 @@ func (k Keeper) SubmitRollappFraud(goCtx context.Context, msg *types.MsgRollappF return nil, err } - // check revision number - if rollapp.RevisionNumber != msg.RollappRevision { - err := errorsmod.Wrap(gerrc.ErrFailedPrecondition, "revision number mismatch") - ctx.Logger().Error(err.Error()) - return nil, err - } - // validate the rollapp is past its genesis bridge phase if !rollapp.IsTransferEnabled() { err := errorsmod.Wrap(gerrc.ErrFailedPrecondition, "rollapp is not past genesis bridge phase") diff --git a/x/rollapp/types/fraud_proposal.pb.go b/x/rollapp/types/fraud_proposal.pb.go index 861064106..6f2c9e9e6 100644 --- a/x/rollapp/types/fraud_proposal.pb.go +++ b/x/rollapp/types/fraud_proposal.pb.go @@ -34,10 +34,10 @@ type MsgRollappFraudProposal struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // RollappID is the rollapp id. RollappId string `protobuf:"bytes,2,opt,name=rollapp_id,json=rollappId,proto3" json:"rollapp_id,omitempty"` - // rollapp revision. used to verify the rollapp revision is the same as the one in the fraud proposal - RollappRevision uint64 `protobuf:"varint,3,opt,name=rollapp_revision,json=rollappRevision,proto3" json:"rollapp_revision,omitempty"` - // The height of the fraudelent block + // The height of the fraudulent block FraudHeight uint64 `protobuf:"varint,4,opt,name=fraud_height,json=fraudHeight,proto3" json:"fraud_height,omitempty"` + // Revision of fraudulent block + FraudRevision uint64 `protobuf:"varint,3,opt,name=fraud_revision,json=fraudRevision,proto3" json:"fraud_revision,omitempty"` // sequencer address to punish. optional PunishSequencerAddress string `protobuf:"bytes,6,opt,name=punish_sequencer_address,json=punishSequencerAddress,proto3" json:"punish_sequencer_address,omitempty"` // rewardAddr is bech32 for sdk acc addr @@ -91,16 +91,16 @@ func (m *MsgRollappFraudProposal) GetRollappId() string { return "" } -func (m *MsgRollappFraudProposal) GetRollappRevision() uint64 { +func (m *MsgRollappFraudProposal) GetFraudHeight() uint64 { if m != nil { - return m.RollappRevision + return m.FraudHeight } return 0 } -func (m *MsgRollappFraudProposal) GetFraudHeight() uint64 { +func (m *MsgRollappFraudProposal) GetFraudRevision() uint64 { if m != nil { - return m.FraudHeight + return m.FraudRevision } return 0 } @@ -165,32 +165,32 @@ func init() { } var fileDescriptor_120f0332aea0a45b = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xbf, 0x4e, 0xe3, 0x40, - 0x10, 0xc6, 0xb3, 0xb9, 0x28, 0x77, 0xd9, 0x9c, 0xee, 0x4e, 0xab, 0x13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 0xe3, 0x6f, 0xc6, 0x8d, 0x0c, 0xa3, 0x16, 0xfc, 0x9d, 0xae, 0xea, 0x12, 0xea, - 0xb8, 0x81, 0x52, 0x49, 0xda, 0xea, 0x09, 0x3b, 0x4b, 0x10, 0x3a, 0x80, 0x0a, 0x0f, 0x7d, 0x2a, - 0x5d, 0x53, 0x92, 0x9b, 0x90, 0xf8, 0x43, 0x22, 0x4c, 0xcb, 0xb6, 0x05, 0x91, 0x52, 0xa9, 0x26, - 0xd1, 0x6b, 0xa9, 0xde, 0xcf, 0xe5, 0xe3, 0x54, 0x45, 0x2a, 0xfc, 0x25, 0xc8, 0xad, 0x25, 0x6c, - 0x42, 0x94, 0x9f, 0x49, 0x67, 0x51, 0x1f, 0xfe, 0xb9, 0xff, 0x78, 0xd9, 0x5e, 0xac, 0xd4, 0x6e, - 0xc1, 0xcd, 0x15, 0xdf, 0xc2, 0x20, 0x92, 0x33, 0x5f, 0x92, 0xdd, 0x67, 0x00, 0xeb, 0x39, 0xec, - 0x49, 0x07, 0x3d, 0x02, 0x88, 0xfa, 0xe1, 0xc0, 0xa3, 0xc1, 0xb2, 0x0d, 0xed, 0xeb, 0x5f, 0xff, - 0x26, 0x7d, 0x45, 0x8e, 0x7a, 0xf4, 0x4d, 0x63, 0x3e, 0xe0, 0xc9, 0xc5, 0xeb, 0x4c, 0x03, 0xd3, - 0x99, 0x06, 0xde, 0x67, 0x1a, 0x78, 0x9a, 0x6b, 0xa5, 0xe9, 0x5c, 0x2b, 0xbd, 0xcd, 0xb5, 0xd2, - 0xd5, 0x9e, 0x43, 0x03, 0x37, 0x1c, 0xe8, 0x43, 0xe6, 0xe1, 0x15, 0x97, 0x37, 0xee, 0xe2, 0x49, - 0x71, 0x7e, 0x41, 0xc4, 0x89, 0x1c, 0x54, 0x93, 0x3b, 0xe9, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, - 0xbe, 0x68, 0xc5, 0x9b, 0xad, 0x02, 0x00, 0x00, + // 394 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0xbf, 0x6e, 0xda, 0x40, + 0x18, 0xe7, 0x28, 0xa2, 0xe5, 0x68, 0x19, 0x4e, 0x55, 0xb1, 0xac, 0xd6, 0x05, 0xa4, 0x4a, 0xa8, + 0x83, 0x4f, 0x2d, 0x95, 0x5a, 0x75, 0xa9, 0x9a, 0x21, 0x4a, 0x06, 0xa2, 0xc8, 0x6c, 0x59, 0x2c, + 0x83, 0x2f, 0xf6, 0x49, 0xd8, 0x77, 0xb9, 0xb3, 0x09, 0xce, 0x98, 0x21, 0x63, 0x94, 0x27, 0xc8, + 0x33, 0xe4, 0x31, 0x32, 0x32, 0x66, 0x8c, 0x60, 0xc8, 0x6b, 0x44, 0xbe, 0x33, 0x86, 0x85, 0x0c, + 0x99, 0xee, 0xbe, 0xdf, 0x1f, 0xfd, 0xbe, 0xef, 0xee, 0x83, 0x03, 0x3f, 0x8b, 0x48, 0x2c, 0x29, + 0x8b, 0xe7, 0xd9, 0x05, 0x2e, 0x0b, 0x2c, 0xd8, 0x74, 0xea, 0x71, 0x8e, 0x4f, 0x85, 0x97, 0xfa, + 0x2e, 0x17, 0x8c, 0x33, 0xe9, 0x4d, 0x6d, 0x2e, 0x58, 0xc2, 0x90, 0xb5, 0x6d, 0xb2, 0xcb, 0xc2, + 0x2e, 0x4c, 0xe6, 0xc7, 0x80, 0x05, 0x4c, 0x49, 0x71, 0x7e, 0xd3, 0x2e, 0xb3, 0x3d, 0x61, 0x32, + 0x62, 0x12, 0x47, 0x32, 0xc0, 0xb3, 0x1f, 0xf9, 0xa1, 0x89, 0xde, 0x55, 0x15, 0xb6, 0x87, 0x32, + 0x70, 0xb4, 0x7b, 0x3f, 0x4f, 0x3c, 0x2e, 0x02, 0xd1, 0x67, 0xd8, 0xf0, 0xd2, 0x24, 0x64, 0x82, + 0x26, 0x99, 0x01, 0x3a, 0xa0, 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 0x5b, 0x37, 0x1b, + 0xe0, 0x79, 0xb9, 0x7a, 0x49, 0xc6, 0x89, 0x1c, 0xd7, 0xd5, 0x8e, 0x0c, 0x9e, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x07, 0xa4, 0x45, 0x37, 0xa9, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -312,8 +312,8 @@ func (m *MsgRollappFraudProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x20 } - if m.RollappRevision != 0 { - i = encodeVarintFraudProposal(dAtA, i, uint64(m.RollappRevision)) + if m.FraudRevision != 0 { + i = encodeVarintFraudProposal(dAtA, i, uint64(m.FraudRevision)) i-- dAtA[i] = 0x18 } @@ -382,8 +382,8 @@ func (m *MsgRollappFraudProposal) Size() (n int) { if l > 0 { n += 1 + l + sovFraudProposal(uint64(l)) } - if m.RollappRevision != 0 { - n += 1 + sovFraudProposal(uint64(m.RollappRevision)) + if m.FraudRevision != 0 { + n += 1 + sovFraudProposal(uint64(m.FraudRevision)) } if m.FraudHeight != 0 { n += 1 + sovFraudProposal(uint64(m.FraudHeight)) @@ -509,9 +509,9 @@ func (m *MsgRollappFraudProposal) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RollappRevision", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FraudRevision", wireType) } - m.RollappRevision = 0 + m.FraudRevision = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowFraudProposal @@ -521,7 +521,7 @@ func (m *MsgRollappFraudProposal) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.RollappRevision |= uint64(b&0x7F) << shift + m.FraudRevision |= uint64(b&0x7F) << shift if b < 0x80 { break }