Comparing version 0.0.5 to 0.1.1
{ | ||
"name": "zos-lib", | ||
"version": "0.0.5", | ||
"version": "0.1.1", | ||
"description": "zeppelin_os library", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -24,3 +24,3 @@ # zeppelin_os library | ||
- [Develop and operate a complex upgradeable app](#complex) with multiple smart contracts which are connected to the zOS Kernel upgradeable standard libraries. | ||
- [Develop a zOS Kernel standard library release.](#kernel) | ||
- [Develop a zOS Kernel standard library release.](https://github.com/zeppelinos/kernel#developing-kernel-standard-libraries) | ||
@@ -110,4 +110,3 @@ ## <a name="single"></a> Develop and deploy a single upgradeable smart contract | ||
## <a name="kernel"></a> Develop a zOS Kernel standard library release. | ||
## Develop a zOS Kernel standard library release | ||
See [this guide in the zeppelinos/kernel repo](https://github.com/zeppelinos/kernel#developing-kernel-standard-libraries) to learn how to develop new zOS kernel standard library releases. |
@@ -136,2 +136,4 @@ const encodeCall = require('../../../lib/encodeCall') | ||
this.proxy = await OwnedUpgradeabilityProxy.at(this.proxyAddress) | ||
await this.directory.setImplementation(contract, this.implementation_v1, { from: directoryOwner }) | ||
}) | ||
@@ -142,20 +144,8 @@ | ||
describe('when the requested contract was registered', function () { | ||
beforeEach(async function () { | ||
await this.directory.setImplementation(contract, this.implementation_v1, { from: directoryOwner }) | ||
}) | ||
it('upgrades to the requested implementation', async function () { | ||
await this.manager.upgradeTo(this.proxyAddress, contract, { from }) | ||
it('upgrades to the requested implementation', async function () { | ||
await this.manager.upgradeTo(this.proxyAddress, contract, { from }) | ||
const implementation = await this.proxy.implementation() | ||
assert.equal(implementation, this.implementation_v1) | ||
}) | ||
const implementation = await this.proxy.implementation() | ||
assert.equal(implementation, this.implementation_v1) | ||
}) | ||
describe('when the requested contract was not registered', function () { | ||
it('reverts', async function () { | ||
await assertRevert(this.manager.upgradeTo(this.proxyAddress, contract, { from })) | ||
}) | ||
}) | ||
}) | ||
@@ -167,3 +157,2 @@ | ||
it('reverts', async function () { | ||
await this.directory.setImplementation(contract, this.implementation_v1, { from: directoryOwner }) | ||
await assertRevert(this.manager.upgradeTo(this.proxyAddress, contract, { from })) | ||
@@ -190,35 +179,27 @@ }) | ||
describe('when the requested contract was registered', function () { | ||
beforeEach(async function () { | ||
await this.directory.setImplementation(contract, this.behavior.address, { from: directoryOwner }) | ||
await this.manager.upgradeToAndCall(this.proxyAddress, contract, initializeData, { from, value }) | ||
}) | ||
beforeEach(async function () { | ||
await this.directory.setImplementation(contract, this.behavior.address, { from: directoryOwner }) | ||
await this.manager.upgradeToAndCall(this.proxyAddress, contract, initializeData, { from, value }) | ||
}) | ||
it('upgrades to the requested implementation', async function () { | ||
const implementation = await this.proxy.implementation() | ||
assert.equal(implementation, this.behavior.address) | ||
}) | ||
it('upgrades to the requested implementation', async function () { | ||
const implementation = await this.proxy.implementation() | ||
assert.equal(implementation, this.behavior.address) | ||
}) | ||
it('calls the "initialize" function', async function() { | ||
const initializable = InitializableMock.at(this.proxyAddress) | ||
const x = await initializable.x() | ||
assert.equal(x, 42) | ||
}) | ||
it('calls the "initialize" function', async function() { | ||
const initializable = InitializableMock.at(this.proxyAddress) | ||
const x = await initializable.x() | ||
assert.equal(x, 42) | ||
}) | ||
it('sends given value to the delegated implementation', async function() { | ||
const balance = await web3.eth.getBalance(this.proxyAddress) | ||
assert(balance.eq(value)) | ||
}) | ||
it('uses the storage of the proxy', async function () { | ||
// fetch the x value of Initializable at position 0 of the storage | ||
const storedValue = await web3.eth.getStorageAt(this.proxyAddress, 1) | ||
assert.equal(storedValue, 42) | ||
}) | ||
it('sends given value to the delegated implementation', async function() { | ||
const balance = await web3.eth.getBalance(this.proxyAddress) | ||
assert(balance.eq(value)) | ||
}) | ||
describe('when the requested contract was not registered', function () { | ||
it('reverts', async function () { | ||
await assertRevert(this.manager.upgradeToAndCall(this.proxyAddress, contract, initializeData, { from, value })) | ||
}) | ||
it('uses the storage of the proxy', async function () { | ||
// fetch the x value of Initializable at position 0 of the storage | ||
const storedValue = await web3.eth.getStorageAt(this.proxyAddress, 1) | ||
assert.equal(storedValue, 42) | ||
}) | ||
@@ -225,0 +206,0 @@ }) |
@@ -32,3 +32,3 @@ const assertRevert = require('../../../lib/assertRevert') | ||
assert.equal(logs.length, 1) | ||
assert.equal(logs[0].event, 'ImplementationAdded') | ||
assert.equal(logs[0].event, 'ImplementationChanged') | ||
assert.equal(logs[0].args.contractName, contractName) | ||
@@ -35,0 +35,0 @@ assert.equal(logs[0].args.implementation, this.implementation_v0) |
@@ -101,5 +101,4 @@ const Package = artifacts.require('Package') | ||
describe('when the requested version was not set', function () { | ||
it('returns the zero address', async function () { | ||
const registeredDirectory = await this.package.getVersion(version) | ||
assert.equal(registeredDirectory, 0x0) | ||
it('reverts', async function () { | ||
await assertRevert(this.package.getVersion(version)) | ||
}) | ||
@@ -106,0 +105,0 @@ }) |
@@ -60,8 +60,2 @@ 'use strict' | ||
describe('when the given implementation is the same as the current one', function () { | ||
it('reverts', async function () { | ||
await assertRevert(this.proxy.upgradeTo(this.implementation_v0, { from })) | ||
}) | ||
}) | ||
describe('when the given implementation is the zero address', function () { | ||
@@ -68,0 +62,0 @@ it('reverts', async function () { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
62
188019
1606
111