git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit 1039324df6ed695b396944c8d6f5f4157f3bf6ce

Kernel: execute contract in createHandler to retrieve the runtime bytecode

Alex Beregszaszi committed on 8/26/2016, 9:40:45 PM
Parent: 05bf86af31b825ac9b412fbc4b18522d2b40e829

Files changed

index.jschanged
index.jsView
@@ -126,17 +126,22 @@
126126 }
127127
128128 createHandler (create) {
129129 // Inject metering
130- const code = this.callHandler({ to: meteringContract, data: create.data }).returnValue
130+ const code = this.callHandler({ to: meteringContract, data: code }).returnValue
131131
132132 let address = Utils.newAccountAddress(create.from, code)
133133
134134 this.environment.addAccount(address.toString(), {
135135 balance: create.value,
136136 code: code
137137 })
138138
139+ // Run code and take return value as contract code
140+ code = this.callHandler({ from: create.from, to: address, gasLimit: create.gasLimit }).returnValue
141+
142+ this.environment.state.get(address.toString()).set('code', code)
143+
139144 return {
140145 accountCreated: address
141146 }
142147 }
@@ -174,9 +179,9 @@
174179 return this.createHandler({
175180 from: tx.from,
176181 gasLimit: tx.gasLimit,
177182 value: tx.value,
178- data: txdata
183+ data: tx.data
179184 })
180185 }
181186 }
182187

Built with git-ssb-web