Skip to content

Commit bc6e9ec

Browse files
pkieltykamarino39Agusx1211patrislav
authored
WaaS (#96)
* WaaS: changes (#87) * Fix: AuxData has outdated message in case if one of the signers is sequence.Wallet * Fix: Wallet.Deploy not working for v1 / sequence.Wallet as a signer no type in signature * Fix: testUtil.MustFundAddress gas limit too low for some smart contract wallets * Fix: SigningService uses Sign instead of SignWith that's allows to select correct signer(especially important in case of guard Sequence v2) * Fix: guard signature validation problem * Fix: AuxData.Sig to contain full signing chain * Wallet add Sequence Sessions * Fix: Wallet.SignDigest panic * Fix: v2 effective weight 0 when recovering dynamic signature * Wallet use Wallet.buildSignature * core: v2 restore effective weight * Wallet.Deploy gaslimit to be set only for v1 * Transaction Policy List (#91) * core.SigningOrchestrator race fix attempt * signing-service: SignContext * guard: SignContext * Wallet return error on signer fail * Remove AuxData * Restore AuxData - it needs to stay for transitory period * Fix: SigningOrchestrator race 2 * Fix: SigningOrchestrator no signature for not first * Fix: Wallet.SignDigest inner build signature * Fix: Wallet.SignDigest inner build signature * Fix: GuardSigningService not first * GuardSigningService unit tests * Use v0.10.0 webrpc generated signing-service api * Wallet.SignMessage: SignContext.WalletAddress not set * Wallet add unit test testing SignContext expectations * Fix receipt listener (#94) * Use ethkit with fixed receipt listener * Use ethkit with fixed receipt listener - versioned * LocalRelayer & RPCRelayer to deploy wallet if wallet not deployed * WaaS Intents (#102) * use [email protected] * Implement waas intents * Add ParseHexOrDec * Implement canSign interface on sequence wallets * Use digest signer if possible * Fix try cast different generics * Skip address from confing on defined addr * check packet code fix * Add marshal json * Use canonical json * Add validate session packes * Add delayed abi primitives * Handle delayedEncode intent * Update ValidateSessionPacket fields * Update ValidateSessionPacket fields - make RedirectURL optional * Add fields to intents * Nonce defined by identifier * Use BasePacketForWallet on ValidateSessionPacket * Add get session packet * Add send transaction types * Expose relayer simulate * Add FinishValidateSessionPacket to intents * Add Intent.IsValid & BasePacket.IsValid * Resolve cyclic dependency in intents package * Intent.IsValid special-case openSession as it does not need to be signed --------- Co-authored-by: Peter Kieltyka <[email protected]> Co-authored-by: Agusx1211 <[email protected]> * RpcRelayer remove add deploy if wallet not deployed This is now done in api waas. * Update sequence.Relayer interface to have simulate method (#103) * Refactor relayer package (#104) * Remove signing-service - no longer usable (#105) * Remove signing-service - no longer usable * Remove signing-service references * Remove signing-service tests * Fix CloseSessionPacket code verification (#110) * Intents: New intents & SECP256R1 (#107) * Add support for Intent sessions built on secp256r1 * Add support for Intent sessions built on secp256r1 - remove prefix * Add support for Intent sessions built on secp256r1 - remove prefix 2 * Add support for Intent sessions built on secp256r1 - add prefix again * Add more verbose errors in intent validation * debug - 1 * debug - 2 * debug - 3 * debug - 4 * debug - 5 * remove debugs * Make distinct split between SessionId and SessionVerifier(the value used for signature verification) * Make distinct split between SessionId and SessionVerifier(the value used for signature verification) - 2 * Intent signers extraction impr * More refactor session to sessionId * Add type for IntentVerifierGetter * Add packet resp OpenSessionPacketResponse * Add packet resp OpenSessionPacketResponse 2 * Add packet resp OpenSessionPacketResponse 3 * Return to having sessionId = pubKey/sessAdddr * Fix: openSession * Fix: p256r1 signature check * remove: OpenSessionPacketResponse * Fix: intent test * refactor Intent.isValidSignature * refactor Intent.isValidSignature - 2 * waas new intent (#115) * new intent struct * new intent struct generate typescript * intent session signers * IntentTyped.ToIntent -> IntentTyped.AsIntent * fix: typo * Intent.isValidSignature to return error * applied review remarks * intent data validators support * update intent.ridl * add transaction extensions * sign message ext * rename * fix: tests * fix: the transaction structs, rem packet * move to intents & add responses stubs * intent.ridl update * Add missing delayedEncode transaction type * intent.ridl update * intent.ridl update * intent.ridl update * intent.ridl update * fix sig verification * revert: fix sig verification * intents: add comment & IntentTyped.AsIntent to IntentTyped.ToIntent --------- Co-authored-by: Patryk Kalinowski <[email protected]> * intents: apply review remarks --------- Co-authored-by: Patryk Kalinowski <[email protected]> * is message eip191 (#119) * add IsEIP191Message & MessageToEIP191 * move to separate files * check full prefix * Make intents verify the EIP191 message as well. * fix: intent double data serialization (#122) * Merge branch 'master' into v2 - fix tests --------- Co-authored-by: Marcin Górzyński <[email protected]> Co-authored-by: Agusx1211 <[email protected]> Co-authored-by: Patryk Kalinowski <[email protected]>
1 parent 6bb51f1 commit bc6e9ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3481
-1135
lines changed

auth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestEthAuthEIP6492(t *testing.T) {
3939
assert.NoError(t, err)
4040
copy(digest[:], digest_)
4141

42-
signature, _, err := wallet.SignDigest(context.Background(), digest, testChain.ChainID())
42+
signature, err := wallet.SignDigest(context.Background(), digest, testChain.ChainID())
4343
assert.NoError(t, err)
4444

4545
signature, err = sequence.EIP6492Signature(signature, wallet.GetWalletConfig())

core/core.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,12 @@ type SignerSignature struct {
124124
Subdigest Subdigest
125125
Type SignerSignatureType
126126
Signature []byte
127+
Error error
127128
}
128129

129130
// ErrSigningFunctionNotReady is returned when a signing function is not ready to sign and should be retried later.
130131
var ErrSigningFunctionNotReady = fmt.Errorf("signing function not ready")
132+
var ErrSigningNoSigner = fmt.Errorf("no signer")
131133

132134
type SigningFunction func(ctx context.Context, signer common.Address, signatures []SignerSignature) (SignerSignatureType, []byte, error)
133135

@@ -142,6 +144,8 @@ func SigningOrchestrator(ctx context.Context, signers map[common.Address]uint16,
142144
var signatures = make([]SignerSignature, 0, len(signers))
143145
var signaturesExpected = len(signers)
144146
for signer := range signers {
147+
rSigner := signer
148+
145149
wg.Add(1)
146150
go func(signer common.Address) {
147151
defer wg.Done()
@@ -177,13 +181,16 @@ func SigningOrchestrator(ctx context.Context, signers map[common.Address]uint16,
177181

178182
retries++
179183
continue
184+
} else if errors.Is(err, ErrSigningNoSigner) {
185+
err = nil
180186
}
181187
}
182188

183189
signerSignature := SignerSignature{
184190
Type: signatureType,
185191
Signer: signer,
186192
Signature: signature,
193+
Error: err,
187194
}
188195

189196
cond.L.Lock()
@@ -194,7 +201,7 @@ func SigningOrchestrator(ctx context.Context, signers map[common.Address]uint16,
194201
cond.Broadcast()
195202
break
196203
}
197-
}(signer)
204+
}(rSigner)
198205
}
199206

200207
wg.Wait()

core/v1/v1.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,10 @@ func (c *WalletConfig) BuildSignature(ctx context.Context, sign core.SigningFunc
873873

874874
for range signerWeights {
875875
signerSig := <-signerSignatureCh
876+
if signerSig.Error != nil {
877+
signCancel()
878+
return nil, fmt.Errorf("signer %s signing error: %w", signerSig.Signer.Hex(), signerSig.Error)
879+
}
876880

877881
if signerSig.Signature != nil {
878882
signerSignatures[signerSig.Signer] = signerSignature{

core/v2/v2.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,10 @@ func (c *WalletConfig) BuildRegularSignature(ctx context.Context, sign core.Sign
15221522

15231523
for range configSigners {
15241524
signerSig := <-signerSignatureCh
1525+
if signerSig.Error != nil {
1526+
signCancel()
1527+
return nil, fmt.Errorf("signer %s signing error: %w", signerSig.Signer.Hex(), signerSig.Error)
1528+
}
15251529

15261530
if signerSig.Signature != nil {
15271531
signerSignatures[signerSig.Signer] = signerSignature{signerSig.Signer,
@@ -1566,6 +1570,10 @@ func (c *WalletConfig) BuildNoChainIDSignature(ctx context.Context, sign core.Si
15661570

15671571
for range configSigners {
15681572
signerSig := <-signerSignatureCh
1573+
if signerSig.Error != nil {
1574+
signCancel()
1575+
return nil, fmt.Errorf("signer %s signing error: %w", signerSig.Signer.Hex(), signerSig.Error)
1576+
}
15691577

15701578
if signerSig.Signature != nil {
15711579
signerSignatures[signerSig.Signer] = signerSignature{signerSig.Signer,

estimator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func (e *Estimator) BuildStubSignature(walletConfig core.WalletConfig, willSign,
402402
return core.SignerSignatureTypeEIP1271, sig, nil
403403
}
404404
} else {
405-
return 0, nil, fmt.Errorf("no signature")
405+
return 0, nil, core.ErrSigningNoSigner
406406
}
407407
}
408408

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/0xsequence/go-ethauth v0.13.0
1212
github.com/BurntSushi/toml v1.2.1
1313
github.com/davecgh/go-spew v1.1.1
14+
github.com/gibson042/canonicaljson-go v1.0.3
1415
github.com/goware/breaker v0.1.2
1516
github.com/goware/cachestore v0.8.1
1617
github.com/goware/logger v0.3.0
@@ -40,6 +41,7 @@ require (
4041
github.com/rogpeppe/go-internal v1.9.0 // indirect
4142
github.com/spf13/cobra v1.8.0 // indirect
4243
github.com/spf13/pflag v1.0.5 // indirect
44+
github.com/stretchr/objx v0.5.0 // indirect
4345
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
4446
golang.org/x/crypto v0.19.0 // indirect
4547
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r
5757
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
5858
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
5959
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
60+
github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI=
61+
github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo=
6062
github.com/go-chi/httpvcr v0.2.0 h1:jOsPvc4ZOoyNv9KCv/O4YoSjMFrHFq/Orc90A0DotUU=
6163
github.com/go-chi/httpvcr v0.2.0/go.mod h1:tGX6IOmSd8LEvItVrT4z7I4BdhjHFU5RPTmvsKudD+Q=
6264
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=

guard/guard.go

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)