From bfaefb2b77435190336b751e014790a6bca45cda Mon Sep 17 00:00:00 2001 From: Jun Kimura Date: Thu, 30 May 2024 11:13:11 +0900 Subject: [PATCH] introduce a new option `is_debug_enclave` to allow an enclave created with debug mode Signed-off-by: Jun Kimura --- proto/relayer/provers/lcp/config/config.proto | 1 + relay/config.pb.go | 97 +++++++++++++------ relay/prover.go | 2 +- .../tm2tm/configs/templates/ibc-0.json.tpl | 3 +- .../tm2tm/configs/templates/ibc-1.json.tpl | 3 +- 5 files changed, 72 insertions(+), 34 deletions(-) diff --git a/proto/relayer/provers/lcp/config/config.proto b/proto/relayer/provers/lcp/config/config.proto index 2344fcf..4246273 100644 --- a/proto/relayer/provers/lcp/config/config.proto +++ b/proto/relayer/provers/lcp/config/config.proto @@ -22,4 +22,5 @@ message ProverConfig { string elc_client_id = 8; bool message_aggregation = 9; uint64 message_aggregation_batch_size = 10; + bool is_debug_enclave = 11; } diff --git a/relay/config.pb.go b/relay/config.pb.go index 3cf8f7c..69c07c1 100644 --- a/relay/config.pb.go +++ b/relay/config.pb.go @@ -39,6 +39,7 @@ type ProverConfig struct { ElcClientId string `protobuf:"bytes,8,opt,name=elc_client_id,json=elcClientId,proto3" json:"elc_client_id,omitempty"` MessageAggregation bool `protobuf:"varint,9,opt,name=message_aggregation,json=messageAggregation,proto3" json:"message_aggregation,omitempty"` MessageAggregationBatchSize uint64 `protobuf:"varint,10,opt,name=message_aggregation_batch_size,json=messageAggregationBatchSize,proto3" json:"message_aggregation_batch_size,omitempty"` + IsDebugEnclave bool `protobuf:"varint,11,opt,name=is_debug_enclave,json=isDebugEnclave,proto3" json:"is_debug_enclave,omitempty"` } func (m *ProverConfig) Reset() { *m = ProverConfig{} } @@ -83,37 +84,38 @@ func init() { } var fileDescriptor_2e6956e1b8ef896e = []byte{ - // 465 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x31, 0x6f, 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0x01, 0x04, 0x85, 0x5d, - 0x1e, 0xfd, 0xdf, 0x1d, 0x6f, 0x33, 0x33, 0x75, 0x01, 0xe3, 0xf1, 0xe5, 0xaf, 0xb4, 0x75, 0xb9, - 0x4e, 0x93, 0xab, 0x75, 0x9a, 0xfc, 0x5c, 0xa7, 0xc9, 0xf7, 0x4d, 0xda, 0xba, 0xda, 0xa4, 0xad, - 0x1f, 0x9b, 0xb4, 0xf5, 0xf9, 0x89, 0x54, 0x7e, 0x51, 0xcd, 0x33, 0x6e, 0x96, 0xb9, 0x60, 0x9e, - 0xf1, 0x05, 0x53, 0x85, 0x66, 0xf3, 0xed, 0x5d, 0x3e, 0x97, 0x26, 0x0f, 0x57, 0x38, 0xdf, 0x0f, - 0xf7, 0xf0, 0xea, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xb2, 0x66, 0x9e, 0xbe, 0x02, 0x00, - 0x00, + // 488 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6e, 0xd3, 0x30, + 0x1c, 0xc6, 0x1b, 0x56, 0xc6, 0xea, 0xae, 0x13, 0x78, 0x05, 0x85, 0x82, 0xa2, 0x6a, 0x02, 0x91, + 0x0b, 0x09, 0x02, 0x24, 0xc4, 0xb1, 0xed, 0x76, 0xd8, 0x0d, 0x5a, 0x4e, 0x5c, 0x2c, 0xc7, 0xf9, + 0xcf, 0xb5, 0xe6, 0xc6, 0xc1, 0x76, 0x0a, 0xd9, 0x53, 0xf0, 0x0e, 0xbc, 0xcc, 0x8e, 0x3b, 0x72, + 0x84, 0xf6, 0x45, 0x50, 0xed, 0x94, 0x22, 0xb1, 0x53, 0xe2, 0xef, 0xf7, 0x7d, 0x9f, 0xff, 0xb2, + 0xfe, 0xe8, 0x85, 0x06, 0x49, 0x6b, 0xd0, 0x69, 0xa9, 0xd5, 0x12, 0xb4, 0x49, 0x25, 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, 0x9c, 0x8a, 0x42, 0xd2, 0x6c, 0xb3, 0xc1, + 0x2f, 0xb9, 0x4a, 0xdd, 0xbe, 0x66, 0xfb, 0x6e, 0x73, 0xde, 0xfc, 0x09, 0x00, 0x00, 0xff, 0xff, + 0x7b, 0xda, 0xdc, 0x8f, 0xe8, 0x02, 0x00, 0x00, } func (m *ProverConfig) Marshal() (dAtA []byte, err error) { @@ -136,6 +138,16 @@ func (m *ProverConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.IsDebugEnclave { + i-- + if m.IsDebugEnclave { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x58 + } if m.MessageAggregationBatchSize != 0 { i = encodeVarintConfig(dAtA, i, uint64(m.MessageAggregationBatchSize)) i-- @@ -272,6 +284,9 @@ func (m *ProverConfig) Size() (n int) { if m.MessageAggregationBatchSize != 0 { n += 1 + sovConfig(uint64(m.MessageAggregationBatchSize)) } + if m.IsDebugEnclave { + n += 2 + } return n } @@ -583,6 +598,26 @@ func (m *ProverConfig) Unmarshal(dAtA []byte) error { break } } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field IsDebugEnclave", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowConfig + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.IsDebugEnclave = bool(v != 0) default: iNdEx = preIndex skippy, err := skipConfig(dAtA[iNdEx:]) diff --git a/relay/prover.go b/relay/prover.go index c41ef03..b2e1bcf 100644 --- a/relay/prover.go +++ b/relay/prover.go @@ -64,7 +64,7 @@ func (pr *Prover) GetOriginProver() core.Prover { func (pr *Prover) Init(homePath string, timeout time.Duration, codec codec.ProtoCodecMarshaler, debug bool) error { pr.homePath = homePath pr.codec = codec - if debug { + if pr.config.IsDebugEnclave { ias.SetAllowDebugEnclaves() } if err := pr.originChain.Init(homePath, timeout, codec, debug); err != nil { diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl index a6db803..e1bc5cd 100644 --- a/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-0.json.tpl @@ -25,6 +25,7 @@ "allowed_quote_statuses": ["GROUP_OUT_OF_DATE"], "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], "key_expiration": 604800, - "elc_client_id": "07-tendermint-1" + "elc_client_id": "07-tendermint-1", + "is_debug_enclave": true } } diff --git a/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl b/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl index 6335118..b52be04 100644 --- a/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl +++ b/tests/e2e/cases/tm2tm/configs/templates/ibc-1.json.tpl @@ -25,6 +25,7 @@ "allowed_quote_statuses": ["GROUP_OUT_OF_DATE"], "allowed_advisory_ids": ["INTEL-SA-00219","INTEL-SA-00289","INTEL-SA-00334","INTEL-SA-00477","INTEL-SA-00614","INTEL-SA-00615","INTEL-SA-00617"], "key_expiration": 604800, - "elc_client_id": "07-tendermint-0" + "elc_client_id": "07-tendermint-0", + "is_debug_enclave": true } }