diff --git a/internal/ethapi/api_flight.go b/internal/ethapi/api_flight.go index 18b4d54b..7a73d62d 100644 --- a/internal/ethapi/api_flight.go +++ b/internal/ethapi/api_flight.go @@ -76,8 +76,8 @@ func (s *PublicFlightAPI) CommitTx(ctx context.Context, args *txtool.GTx) error return s.exchange.CommitTx(ctx, args) } -func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk TKAddress, trace keys.Uint256) (root keys.Uint256, e error) { - if r := flight.Trace2Root(tk.ToUint512().NewRef(), &trace); r != nil { +func (s *PublicFlightAPI) Trace2Root(ctx context.Context, tk TKAddress, trace keys.Uint256, base keys.Uint256) (root keys.Uint256, e error) { + if r := flight.Trace2Root(tk.ToUint512().NewRef(), &trace, &base); r != nil { root = *r return } else { diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index a0414d1b..b0c13060 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -935,7 +935,7 @@ web3._extend({ new web3._extend.Method({ name: 'Trace2Root', call: 'flight_trace2Root', - params: 2 + params: 3 }), new web3._extend.Method({ name: 'getOut', diff --git a/zero/txtool/flight/sli.go b/zero/txtool/flight/sli.go index 5b2a35e6..69719c27 100644 --- a/zero/txtool/flight/sli.go +++ b/zero/txtool/flight/sli.go @@ -69,12 +69,13 @@ func DecTraceOuts(outs []txtool.Out, skr *keys.PKr) (douts []txtool.TDOut) { func (self *SLI) GenTx(param *txtool.GTxParam) (gtx txtool.GTx, e error) { - if tx, keys, err := generate.GenTx(param); err != nil { + if tx, keys, bases, err := generate.GenTx(param); err != nil { e = err return } else { gtx.Tx = tx gtx.Keys = keys + gtx.Bases = bases gtx.Gas = hexutil.Uint64(param.Gas) gtx.GasPrice = hexutil.Big(*param.GasPrice) gtx.Hash = tx.ToHash() diff --git a/zero/txtool/flight/sri.go b/zero/txtool/flight/sri.go index c3b240f4..bd5e01d5 100644 --- a/zero/txtool/flight/sri.go +++ b/zero/txtool/flight/sri.go @@ -30,7 +30,7 @@ type SRI struct { var SRI_Inst = SRI{} -func Trace2Root(tk *keys.Uint512, trace *keys.Uint256) (root *keys.Uint256) { +func Trace2Root(tk *keys.Uint512, trace *keys.Uint256, base *keys.Uint256) (root *keys.Uint256) { root_cm := cpt.FetchRootCM(tk, trace) root = localdb.GetRootByRootCM(txtool.Ref_inst.Bc.GetDB(), &root_cm) return diff --git a/zero/txtool/generate/generate.go b/zero/txtool/generate/generate.go index fe828632..dfb559be 100644 --- a/zero/txtool/generate/generate.go +++ b/zero/txtool/generate/generate.go @@ -20,10 +20,11 @@ type gen_ctx struct { Z_Ins []txtool.GIn balance_desc cpt.BalanceDesc Keys []keys.Uint256 + Bases []keys.Uint256 s stx.T } -func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, e error) { +func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, bases []keys.Uint256, e error) { ctx := gen_ctx{} ctx.param = *param ctx.prepare() @@ -42,6 +43,7 @@ func GenTx(param *txtool.GTxParam) (ret stx.T, keys []keys.Uint256, e error) { } ret = ctx.s keys = ctx.Keys + bases = ctx.Bases return } diff --git a/zero/txtool/generate/prove_proc.go b/zero/txtool/generate/prove_proc.go index 445ed9fb..34031a67 100644 --- a/zero/txtool/generate/prove_proc.go +++ b/zero/txtool/generate/prove_proc.go @@ -197,7 +197,7 @@ func (self *gen_ctx) genDesc_Zs() (e error) { in_z.Trace = desc.Til_ret in_z.Proof = desc.Proof_ret self.s.Desc_Z.Ins[input_desc.index] = in_z - + self.Bases = append(self.Bases, keys.Empty_Uint256) self.balance_desc.Zin_acms = append(self.balance_desc.Zin_acms, desc.Asset_cm_ret[:]...) self.balance_desc.Zin_ars = append(self.balance_desc.Zin_ars, desc.Ar_ret[:]...) } diff --git a/zero/txtool/iface.go b/zero/txtool/iface.go index b2bbfbbd..04f3f081 100644 --- a/zero/txtool/iface.go +++ b/zero/txtool/iface.go @@ -29,6 +29,7 @@ type GTx struct { Hash keys.Uint256 Roots []keys.Uint256 Keys []keys.Uint256 + Bases []keys.Uint256 } type GPkgCloseCmd struct {