Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New smart contract factroy #295

Merged
merged 4 commits into from
May 21, 2021
Merged

New smart contract factroy #295

merged 4 commits into from
May 21, 2021

Conversation

Sriep
Copy link
Contributor

@Sriep Sriep commented May 19, 2021

This resolves issue #260

Currently, there is only one smart contract object for each of the smart contracts. Each time a new smart contract is requested, its contents are copied onto itself. This copying is not properly protected against concurrent access.

This PR creates a different instance of a smart contract each time one is called. A new smart contract factory object is built to create them. This extra effort of a factory interface is needed to prevent against import cycles.

@Sriep Sriep linked an issue May 19, 2021 that may be closed by this pull request
@Sriep Sriep changed the title New MakeCopy SmartContractInterface method WIP New MakeCopy SmartContractInterface method May 19, 2021
@Sriep Sriep changed the title WIP New MakeCopy SmartContractInterface method WIP New smart contract factroy May 20, 2021
@Sriep Sriep changed the title WIP New smart contract factroy New smart contract factroy May 20, 2021
@Sriep Sriep requested a review from bbist May 20, 2021 14:08
Copy link
Contributor

@bbist bbist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Sriep Sriep merged commit 867794f into master May 21, 2021
@Sriep Sriep deleted the ssc-id branch May 21, 2021 08:44
peterlimg added a commit that referenced this pull request May 28, 2021
* vc-false-stuck:
  Do not run computeState in goroutine in AddNotarizedBlock
  Fix issue in fetching blocks from sharders
  🐛 AddChallenge: randomise validators (#312)
  🔨 Immutable SmartContract objects (#313)
  check for duplicate blobbers (#272)
  🐛 Conversion Fix For Core
  🐛 Fix invalid type conversion
  🔨 New smart contract factroy (#295)
  Feature: httpclientutil and round tests (#288)
  Feature: add cache and common unit tests (#261)
  Update nginx.conf
  Update nginx.conf
  Feature: add datastore and ememorystore unit tests (#262)
  Feature: smartcontractinterface and tokenpool tests (#291)
  Feature: add encryption and logging unit tests (#264)
  Feature block unit tests (#248)
  🐛 Add mutex to mapIndex (#282)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Race issue: Smart contract id.
2 participants