From 593bbfaee7908255e65df1461609f840e345dbf2 Mon Sep 17 00:00:00 2001 From: sincos Date: Mon, 24 Jun 2024 16:44:44 +0800 Subject: [PATCH] fix: message signature --- cmd/sequencer/main.go | 5 ++++- pkg/modules/event/event_device_confirm.go | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cmd/sequencer/main.go b/cmd/sequencer/main.go index 36bacd5..399ba72 100644 --- a/cmd/sequencer/main.go +++ b/cmd/sequencer/main.go @@ -43,7 +43,10 @@ var ( Blockchain: &blockchain.Blockchain{Contracts: contracts}, MqttBroker: &confmqtt.Broker{}, Database: &database.Postgres{}, - PrivateKey: &crypto.EcdsaPrivateKey{Hex: "dbfe03b0406549232b8dccc04be8224fcc0afa300a33d4f335dcfdfead861c85"}, + // from sprout default sequencer, to make coordinator validate sequencer signature + PrivateKey: &crypto.EcdsaPrivateKey{ + Hex: "dbfe03b0406549232b8dccc04be8224fcc0afa300a33d4f335dcfdfead861c85", + }, } ctx context.Context ) diff --git a/pkg/modules/event/event_device_confirm.go b/pkg/modules/event/event_device_confirm.go index dcd936b..ac348e7 100644 --- a/pkg/modules/event/event_device_confirm.go +++ b/pkg/modules/event/event_device_confirm.go @@ -114,7 +114,7 @@ func (e *DeviceConfirm) Handle(ctx context.Context) (err error) { IMEI: e.imei, Owner: common.BytesToAddress(e.pkg.GetOwner()).String(), Timestamp: e.pkg.GetTimestamp(), - Signature: hex.EncodeToString(e.pkg.GetSignature()), + Signature: hex.EncodeToString(append(e.pkg.GetSignature(), byte(0))), GasLimit: big.NewInt(200000).String(), DataChannel: uint32(dev.DataChannel), })),